Click to See Complete Forum and Search --> : enabling anonymous access


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. :/

boudino
July 31st, 2006, 03:27 AM
To allow anonymous access in IIS, select appropriate virtual site (=application) in IIS console, open Properties, switch to Directory Security Console, click Edit button in Annonymous Access and Authentification Control and play...

But there is another thing which is subject to W2k3 or IIS 6.0 respectively - you must enable write access to web site directory for account under which your IIS runs, or better to appropriate group IIS_WPG. E.g. if you have directory c:\work\website configured as virtual directory in IIS and you host ASP.NET application there, you have to give write privilege to local IIS_WPG group to this directory.

Hope my hints will help you, because I'm not sure if I understood you well :-/

eliashoi
July 31st, 2006, 12:54 PM
Thanks,

I'm not running IIS (I have XP home on my machine - drat!); I'm running the built-in web server in VS 2005. I'll take a look at configuration of the server. Maybe I can find something there.

-Richard