eliashoi
July 30th, 2006, 11:14 AM
Hello,
A week or two ago I posted a message stating that my asp.net 2,0 web development server (the one built into visual studio 2005) was not serving images. I have been working on other things, but when I returned to the issue I finally found something that may be at the root. In the developer network under “troubleshooting the asp.net development server” I found the following:
In a file-system Web site, static files, such as images and style sheets, are subject to ASP.NET authorization rules. For example, static files in a file-system Web site will not be served to an anonymous user when anonymous access to those files is disabled. However, when you deploy the Web site to a server running IIS, IIS will serve the static files without using authorization rules.
My newbie problem is that I don’t know how to allow anonymous access to the image files. I assume I do that with my web.config file, but I haven’t been able to find anything on the subject in developer network (which is way obtuse on finding stuff, eh?) or either of the asp.net books I have.
Would someone be kind enough to give me a clue, please?
Thanks in advance. :)
-Richard
Update: I just found that if I move my image files up into the website directory (which I don't want to do) instead of keeping them in the .\App_Data directory, they serve just fine. I presume I need to set access by folder, eh? But how!?
I tried this (to authorize the directory):
<location path="App_Data">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
and also this (to authorize the actual file):
<location path="App_Data/playing.jpg">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
Neither one fixed the problem. :/
A week or two ago I posted a message stating that my asp.net 2,0 web development server (the one built into visual studio 2005) was not serving images. I have been working on other things, but when I returned to the issue I finally found something that may be at the root. In the developer network under “troubleshooting the asp.net development server” I found the following:
In a file-system Web site, static files, such as images and style sheets, are subject to ASP.NET authorization rules. For example, static files in a file-system Web site will not be served to an anonymous user when anonymous access to those files is disabled. However, when you deploy the Web site to a server running IIS, IIS will serve the static files without using authorization rules.
My newbie problem is that I don’t know how to allow anonymous access to the image files. I assume I do that with my web.config file, but I haven’t been able to find anything on the subject in developer network (which is way obtuse on finding stuff, eh?) or either of the asp.net books I have.
Would someone be kind enough to give me a clue, please?
Thanks in advance. :)
-Richard
Update: I just found that if I move my image files up into the website directory (which I don't want to do) instead of keeping them in the .\App_Data directory, they serve just fine. I presume I need to set access by folder, eh? But how!?
I tried this (to authorize the directory):
<location path="App_Data">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
and also this (to authorize the actual file):
<location path="App_Data/playing.jpg">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
Neither one fixed the problem. :/