0

Hi there I am writing ASP.NET app
I want to access gif images stored in Images folder which is in turn stored in Project folder. See my Solution Explorer.

In GetImage.ashx (see solution explorer), I am unable to get images using this:

System.IO.FileStream _FileStream = new System.IO.FileStream("~/Images/" + imageFileName + ".gif", System.IO.FileMode.Open, System.IO.FileAccess.Read);

It gives exception Couldd not find a part of path 'C:\Program Files (x86)\Common Files\Microsoft Shared\DevServer\10.0\~\Images\alien_tai_chi_md_wht.gif'.

Please help. Currently I am using full directory specification:
System.IO.FileStream _FileStream = new System.IO.FileStream(@"C:\Users\MAHESH\Desktop\s\ASPNETWebsites\WebDataDisplay\Images\"+imageFileName+".gif", System.IO.FileMode.Open, System.IO.FileAccess.Read);

3
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by mani-hellboy
0

use this will help you

System.IO.FileStream(server.MapPath("~/Images/" + imageFileName + ".gif",System.IO.FileMode.Open, System.IO.FileAccess.Read);

Edited by mani-hellboy: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.