C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Articles » ASP.NET/Web Applications »

Form based authentication in ASP.Net


Posted Date: 17 Mar 2004    Resource Type: Articles    Category: ASP.NET/Web Applications
Author: ManojRajanMember Level: Gold    
Rating: 1 out of 5Points: 3



ASP.Net has a builtin method for the user authenticaiton. So you no more need the cookies variable and No more we need to track the login state ( Which is required when a user enters a url for the page he is not authorised to view), to provide the pages to the user request.In ASP.Net, you can configure the Web.config file existing the root directory of the application, you can see it in the solution explorer. There you can see a tag authentication like this


< authentication mode="Windows" />

Edit this tag to

< authentication mode="Forms">
< forms name="LoginCookie" loginUrl="Login.aspx">
< credentials passwordFormat="Clear">
< user name="Chatanya" password="Agrawal" />
< user name="manoj" password="rajan" />
< /credentials>
< /forms>
< /authentication>

Where LoginCookie is the name of the cookie automatically created by the authentication module.

This will restrict the user to access any page only after authentication, however you do not need authentication for accessing the login page, so you put the code specified below after the system.web tag

In the example above the password is kept in clear text, you can consider encrypting the username and password if needed.


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

Now in the login form instead of checking the username , password seperately, use the form's authenticate method.




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Web.Config
Previous Resource: Persistent Forms Authentication
Return to Discussion Resource Index
Post New Resource
Category: ASP.NET/Web Applications


Post resources and earn money!
 
Related Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use