I'm new to using c# with asp.net ajax so any help is appreciated. I am using System.Drawing.Image
to get my image's virtual path with Image.FromFile()
and want to return the image to be set up in my web application. Thanks in advance for any response!
I have created a physical path then converted it to a virtual path then used Server.MapPath
to get the equivalent path to assign to my Image image
.
string pImagePath = @"C:\Apps\WebApp.Roll\Images\Profiles\" + item.Value.ToString();
string vImagePath = pImagePath.Replace(@"C:\Apps\WebApp.Roll", "~").Replace(@"\", "/");
Image image = Image.FromFile(System.Web.HttpContext.Current.Server.MapPath(vImagePath), true);
#item.value is name of the image file.
My path is correct but whenever I debug to see what my Image image
is, it tells me that my image
is System.Drawing.BitMap
What am I doing wrong?