Excluding Registration Page from Forms Authentication

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)

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.

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.

Happy Programming!

Print | posted on Monday, April 25, 2005 7:35 AM

Comments on this post

# re: Excluding Registration Page from Forms Authentication

Requesting Gravatar...
Thanks! That is exactly what I'm looking for! I need a forgot password page for my site that won't redirect to the login page.
Left by Steve-O on Jun 10, 2005 4:28 PM

# re: Excluding Registration Page from Forms Authentication

Requesting Gravatar...
Thanks! i was looking for this..both for resistration page and password page..

thanks a lot
Left by Simi on Dec 17, 2006 10:23 PM

# re: Excluding Registration Page from Forms Authentication

Requesting Gravatar...
Thank you for this tip, it saved me a lot of time.
Left by Arvind on Feb 26, 2008 6:50 AM

# re: Excluding Registration Page from Forms Authentication

Requesting Gravatar...
Thans a lot!! :-) looking for the same..
Left by Adam on May 13, 2008 7:21 PM

# re: Excluding Registration Page from Forms Authentication

Requesting Gravatar...
This is what I was looking for!!

Cheers,
Vidhya
Left by Vidhya on Aug 12, 2008 9:39 PM

# re: Excluding Registration Page from Forms Authentication

Requesting Gravatar...
When I do the above and set any page as start page, that page is loaded without redirecting to logon page. Am I missing something?
Left by sim on Nov 01, 2008 2:23 AM

# re: Excluding Registration Page from Forms Authentication

Requesting Gravatar...
yeah super blog in answer
Left by azdırıcı on Nov 30, 2008 5:42 PM

# re: Excluding Registration Page from Forms Authentication

Requesting Gravatar...
.both for resistration page and password page..
thanks a lot When I do the above and set any page as start page, t
Left by mario oyunları on Sep 21, 2009 10:48 AM

# re: Excluding More than one Page from Forms Authentication

Requesting Gravatar...
hi i hav doubt on how to exclude more than one page from forms authentication
Left by mary on Mar 22, 2010 6:12 PM

# re: Excluding Registration Page from Forms Authentication

Requesting Gravatar...
A unbiased no holds barred look at Shaklee and the business opportunity! Read on if you are researching Shaklee!
Left by article directory submission on May 08, 2010 6:46 PM

Your comment:

 (will show your gravatar)