c# - Not able to find the image by Server.MapPath() -


below code using image not coming, have checked path , correct.

system.web.httpcontext.current.server.mappath(@"\images\myapp.png"); 

may know reason this?

try code

string root = system.web.httpcontext.current.server.mappath("~/images"); string rootpath = string.format("{0}\\{1}", root, "myapp.png"); 

add ~ , put bars /


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -