Authentication options in IIS 7.5 and ASP.Net, what's the difference?

I am just starting to learn web programming with IIS 7.5 on Windows 2008 R2 and ASP.Net 4.

I noticed that both IIS and ASP.Net can define authentication rules. There is a form authentication option in IIS where I can redirect the user to the specified page for authentication, for example below:

alt text

And then, in the ASP web.config file, I find similar settings:

<authentication mode="Forms"> <forms loginUrl="~/Account/Login.aspx" timeout="2880" /> </authentication> 

When I complete both options, I assume that any page request will be redirected to the login.aspx page. But this is not so. Therefore, I am confused. How do two sets of configurations work? And why is the page request not redirected?

thanks

Update

Finally, I have earned, and I think I understand now. My site structure is as follows:

alt text

It's about changing the rules of Autherization. Renounce all unauthorized root users:

  <authorization> <deny users="?" /> </authorization> 

CSS files must be allowed for all users, so I have Styles \ web.config:

  <authorization> <allow users="*" /> </authorization> 

and allow unauthorized users access to register.aspx, so I have an account \ web.config:

  <location path="Register.aspx"> <system.web> <authorization> <allow users="*"/> </authorization> </system.web> </location> <system.web> <authorization> <deny users="?"/> </authorization> </system.web> 
+4
source share
2 answers

Here is another component you need to configure: authorization. If you do not, unauthorized users have access to all pages and will not be redirected to the login page. For instance:

 <authorization> <deny users="?" /> </authorization> 

Indicates that all non-authenticated users are denied access to the pages of your application. The authorization element is part of the system.web configuration system.web .

+3
source

If you installed something in IIS with authentication (in your validation form of your case). It will also modify your associated project webconfig file with the same settings. That is why you see the same information in both modules.

+1
source

All Articles