ASP.NET photo directory doesnt work

Posted on 2009-02-17
Last Modified: 2012-05-06
I recently setup a website that was online before. I set it up locally on intranet. Everything works except the photos dont display.
I have put the photos in the right directory.

I get this error in safari

Safari cant open D:/PRTR/prtrlive/uploadphoto/34978.jpg because the address does not start with a valid character.


						dim CandidatePhoto as string

						if File.Exists(Profile.UploadFolder & "photo\" & cnID & ".gif")  	

							CandidatePhoto = cnID & ".gif"

						end if

						if File.Exists(Profile.UploadFolder & "photo\" & cnID & ".jpg")

							CandidatePhoto = cnID & ".jpg"

						end if

						if CandidatePhoto <> "" then


						<a href="<%=Profile.UploadPath%>photo/<%=CandidatePhoto%>" target="_blank"><img src="<%=Profile.UploadPath%>photo/<%=CandidatePhoto%>" width="175" height="175" alt="Candidate Photo [<%=cnID%>]" border="0"></a>


						<img src="<%=Profile.AppPath%>_images/photoblank175-175.gif" width="175" height="175" alt="">

						<%end if%>




						<td align="center" style="font:bold 9px;"><b><i>click photo to view larger image...</i></b></td>

Open in new window

Question by:isaackhazi
    LVL 26

    Assisted Solution

    by:Anurag Thakur
    shoudnt the path be D:\PRTR\prtrlive\uploadphoto\34978.jpg instead of

    i dont know how the path is being made but this seems like the reason
    LVL 8

    Assisted Solution

    try adding "file://" before the path
    LVL 12

    Accepted Solution

    I think, Profile.UploadPath is storing the path as local drive location.  If you access it from intranet, then the machine's, shared path may need to be given.  Else, create a virtual directory and map it to the web server and use the virtual path.
    LVL 8

    Author Comment

    Had to chnage the web.config file Profile.UploadPath to
    Changing it to local host works only on the local machine.

    Thanx guys


    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now