Unable to view image on webserver from child (content) page

I have developed a web application on Visual studio with ASP.NET and C#.
I am using master and child pages
I am able to view the image when running the studio on the local server but not able to view it on the webserver from the child (content) page
On aspx page the code is
 <asp:Image ID="imgApplPhoto" runat="server" Height="125px" Width="124px" />
The code (c#) is
imgApplPhoto.ImageUrl = MapPath("~/App_UserPhotos/") + strtempfn;
I have seen the source in the webpage to identify the reason for non-display of image
  <img id="Main_imgApplPhoto" src="D:\HostingSpaces\suhitamc\oslersacademy.suhitam.com\wwwroot\App_UserPhotos\34_ppsphoto.jpg" style="height:125px;width:124px;" />
AS expected in master and content pages, the image id on the client page is changed Main_imgApplPhoto from its original id imgApplPhoto

I do not whether it makes a difference, in the web server, the web application is a sub-domain accessed with URL


One may wish to login using  credentials for a temporary user
user ID: student2
PW: student2
It is the first page after login i.e. userswitchboard.aspx

Can anyone resolve the issue?
Srinivas ManthaConsultant Anesthesiologist and Pain PhysicianAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dave BaldwinFixer of ProblemsCommented:
An image link is one of the things that you shouldn't be using 'MapPath' for.  It generates an absolute path on the server and the web browser does not have access to that.  Try this...
imgApplPhoto.ImageUrl = "~/App_UserPhotos/" + strtempfn;

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Kamal KhaleefaInformation Security SpecialistCommented:
the image path should be like this


and not the full path
make sure that the folder App_UserPhotos is exist in your project
Srinivas ManthaConsultant Anesthesiologist and Pain PhysicianAuthor Commented:
Thank you for prompt support
Dave BaldwinFixer of ProblemsCommented:
You're welcome.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.