I am developing a .NET for ASP.NET Web Application and am trying to deny all users who are unauthorised from accessing my application but allowing them only to the login page.
Below is a snippet of the code which is inside my system.web section:
<authentication mode="Forms">
<forms loginUrl="Login.aspx" timeout="60" name="APPNAME" slidingExpiration="true" />
</authentication>
<authorization>
<deny users="?" />
</authorization>
I also have this outside to allow access to the login page:
<location path="Login.aspx">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
However I am still able to access pages when I am not logged in, how could I stop this from happening?
I have even added a Web.Config file to the Main folder which stores most of the website files which the contents of is:
<?xml version="1.0"?>
<configuration>
<appSettings/>
<connectionStrings/>
<system.web>
<authorization>
<deny users="?" />
</authorization>
</system.web>
</configuration>
But this is still not having any effect.
Solution
I had followed some optimisation tips for asp.net (http://www.codeproject.com/KB/aspnet/10ASPNetPerformance.aspx) and removed the AnonymousIdentification httpModule which I actually needed.