Resources » .NET programming » ASP.NET/Web Applications

Excluding Pages from Forms Authentication


Posted Date: 13-Sep-2006  Last Updated:   Category: ASP.NET/Web Applications    
Author: Member Level: Gold    Points: 10


This article explains on how to exclude some pages from being protected while implementing Forms based Authentication.



Introduction


All of us would agree that ASP.NET Forms Authentication is very useful and effective in implementing a Form based authentication for websites.

With the methods and properties it provides, it becomes quite easy for us to implement authentication (contrary to the classic asp, where one has to write chunk of codes individually in all the pages)

Login Page and Registration Page


Well, all of us would have a login.aspx which would be the default login page for the app and any unauthorised request for other pages, would redirect to the Login Page.

However, we would like to have a Registration page, in case the user is not a registered user to which he can go from the login page. So, we provie a link called "Register" so that new users can register.

Since we have implemented Forms Authentication for the website, even the Register.aspx page would require logging in. To avoid the Registration page from falling under authentication, a little tweaking is required in the web.config file.

Excluding Registration, Forgot Password pages


In the web.config file where we declare the authentication mode=forms, the following set of tags need to be there

<location path="Register.aspx">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>


This would make the Register.aspx page available to anonymous users.

Same way we can also provide for Forgot Password page, if any.

Summary


This article discussed on how we can exclude certain pages from being protected while implementing Forms Authentication.


Did you like this resource? Share it with your friends and show your love!

Responses to "Excluding Pages from Forms Authentication "

No responses found. Be the first to respond...

Feedbacks      

Post Comment:




  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)



    Type the numbers and letters shown on the left.


    Submit Article     Return to Article Index

    Subscribe to Subscribers
    Active Members
    TodayLast 7 Daysmore...

    Awards & Gifts
    Talk to Webmaster Tony John

    Online Members

    Phagu Mahato
    More...
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India