Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Posted

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

Posted
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

there are 10 kinds of people on earth:

those who understand binary, and those who don't.

  • *Gurus*
Posted (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 by Derek Stone
Posted
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.
Wanna-Be C# Superstar

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...