views:

61

answers:

3

My hypothetical website doesn't allow anonymous access and uses Forms Authentication. So the initial request for www.example.com/SomePage.aspx is redirected to www.example.com/Login.aspx?ReturnUrl=SomePage.aspx.

However users can still access URLs that aren't served by ASP.NET, e.g.: www.example.com/Images/AnImage.jpg or www.example.com/TextFile.txt.

Is it possible to deny anonymous access to these files and use the same Forms Authentication?

+1  A: 

Yes - You must register ASP.NET for every file (.*) extension. this you have to configurate in ISS.

Arthur
I was specifically trying to avoid this as I would then need to implement a custom handler in ASP.NET to serve the request.
batwad
+1  A: 

You can use IIS Extention Mapping. For More information click IIS Extention Mapping

Neil
I still want IIS to serve the request, just check the ASP.NET session. I don't want to re-map everything to ASP.NET.
batwad
You do not have to re map everything to ASP .Net. But you need to map only those extention which you need to use for forms authentication. For More info see this link http://weblogs.asp.net/scottgu/archive/2007/03/04/tip-trick-integrating-asp-net-security-with-classic-asp-and-non-asp-net-urls.aspx
Neil
A: 

There are some ways that will help you solve this problem : Permission under IIS

Braveyard