[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 201
  • Last Modified:

ASP.NET photo directory doesnt work

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

3 Solutions
Anurag ThakurCommented:
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
try adding "file://" before the path
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.
isaackhaziAuthor Commented:
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now