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!

posted @ Monday, April 25, 2005 7:35 AM

Print

Comments on this entry:

# re: Excluding Registration Page from Forms Authentication

Left by Steve-O at 6/10/2005 4:28 PM
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.

# re: Excluding Registration Page from Forms Authentication

Left by Simi at 12/17/2006 10:23 PM
Gravatar
Thanks! i was looking for this..both for resistration page and password page..

thanks a lot

# re: Excluding Registration Page from Forms Authentication

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

# re: Excluding Registration Page from Forms Authentication

Left by Adam at 5/13/2008 7:21 PM
Gravatar
Thans a lot!! :-) looking for the same..

# re: Excluding Registration Page from Forms Authentication

Left by Vidhya at 8/12/2008 9:39 PM
Gravatar
This is what I was looking for!!

Cheers,
Vidhya

# re: Excluding Registration Page from Forms Authentication

Left by sim at 11/1/2008 2:23 AM
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?

# re: Excluding Registration Page from Forms Authentication

Left by azdırıcı at 11/30/2008 5:42 PM
Gravatar
yeah super blog in answer

Your comment:



 (will not be displayed)


 
 
 
 

Live Comment Preview:

 
«July»
SunMonTueWedThuFriSat
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678