Powered by Blogger.

Saturday, March 15, 2014

Forms based authentication in asp.net

In this post we will discuss about forms based authentication in asp.net. Also you can check out:

- Bind dropdownlist using arraylist or hashtable in C#.Net

- How to handle exception in sql server stored procedure?

- Working with enterprise library for data access in asp.net Part-3

- When the client is authenticated based on custom page by verifying credentials with database server then it is called as forms based authentication.

- The security token will be given to the client as an identity of authenticated client.

Change in web.config for modification:

 <authentication mode="Forms">
      <forms name="f1" loginUrl="login.aspx">
      <deny users="?"/>

Here the name attribute will specify cookie name for maintaining security token.

By default it will be .ASPXAUTH

Here while writting code in the Login button we have to use RedirectFromTheLoginPage.

RedirectFromTheLoginPage does two things:

- It will provide requested page to the client.

- It will produce security token in the form of cookies.