crippa Posted July 18, 2004 Posted July 18, 2004 Hi It seems that displaying images with an <img>-tag outside the ASP.NET application directory is not allowed. ex: <img src="../../../../images/gif.gif"> The folder with the images can be anywhere on the server. I guess that i can change the securety setings for ither IIS or the .NET framework but i dont realy want that. How do I solve this in a simpla and(?) flexible way? Thanks! /Christer Quote
*Gurus* Derek Stone Posted July 18, 2004 *Gurus* Posted July 18, 2004 You can display images located at any URL within an ASP.NET page. I'd check your relative path to make sure it is in fact correct. Also keep in mind that ASP.NET handles relative paths differently than straight HTML in some cases. Quote Posting Guidelines
crippa Posted July 18, 2004 Author Posted July 18, 2004 The path is ok. So you can link an image that's located for example in c:\images when the application dir is C:\Inetpub\wwwroot\mywebapp by using the tag <img src="../../../images">? /Christer Quote
huby Posted July 19, 2004 Posted July 19, 2004 The path is ok. So you can link an image that's located for example in c:\images when the application dir is C:\Inetpub\wwwroot\mywebapp by using the tag <img src="../../../images">? /Christer ASP.NET uses a windows account, named ASP_USER or something like that. if you want to access c:\somethingelse, you have to set folder permissions so that ASP.NET actually has access to the folder. by default, ASP_USER only has access to c:\inetpub but it's not a very good idea to do that. try to keep your web applications all in the same place ... or set your application virtual directory to c:\somethingelse Quote there are 10 kinds of people on earth: those who understand binary, and those who don't.
*Gurus* Derek Stone Posted July 19, 2004 *Gurus* Posted July 19, 2004 (edited) The path is ok. So you can link an image that's located for example in c:\images when the application dir is C:\Inetpub\wwwroot\mywebapp by using the tag <img src="../../../images">? /Christer No, you cannot do that unless you reconfigure that directory as the home directory, move it to the Web root or define it as a virtual directory. Otherwise, IIS has no access to that folder. Edited July 19, 2004 by Derek Stone Quote Posting Guidelines
crippa Posted July 19, 2004 Author Posted July 19, 2004 Making the directory outside c:\inetpub a virtual directory might be the solution! I'll try that! Thanks! /Christer Quote
VBAHole22 Posted July 19, 2004 Posted July 19, 2004 If it is a permissions issue you can setup the aspnet process to run not under ASPNET user but impersonate a Win abuser. You set this up in you web.config file. This is a way to give the process more privileges without opening the door to the whole directory for every user that might hit your site. Quote Wanna-Be C# Superstar
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.