I have a default image in my folder in visual studio.
How can I get the server path to find the image in runtime in code?
if (String.IsNullOrEmpty(entry.Picture))
{
//image1.ImageUrl = @"F:\Temp\Projects\IMEICHECK\IMEICHECK\Images\Design\New\no-image.gif";
}
else
image1.ImageUrl = entry.Picture;
It looks as though perhaps your image path is not part of the website or web application. This is not good practice.
You should put the image in a common location within the web app/site, such as:
/Common/Images/no-image.gifAnd then easily store that path either in the web.config
appSettingssection, or as a constant string in your code-behind if it’s only used in one place.