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?
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.
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">?
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">?
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
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">?
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.
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.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.