What is the Advantage of forms authentication over using session variable?

Posted by Hanishani under ASP.NET on 9/8/2013 | Points: 10 | Views : 2350 | Status : [Member] | Replies : 2
Hai, I want to know the advantage of using forms authentication in asp.net application over using session variables?

Thanks in Advance.


Posted by: Bandi on: 9/8/2013 [Member] [MVP] Platinum | Points: 25

refer this link

Mark This Response as Answer

Hanishani, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Webmaster on: 9/8/2013 [Administrator] HonoraryPlatinum | Points: 25

A lot of advantage, few of them are listed here.

1. In forms authentication, a cookie is created that is client side so no load on the server however in session, different session objects are created for different user so load on the server.

2. In Forms authentication, you will have a inbuilt object that provides you all the details of authentication that you can use wherever you want. In session you will have to check for Session manually for each page you want to authenticate that is repeating of code and a lot of work, also prone to error in case session expired.

3. Your code looks neater and there are different kinds of forms authentication its mode and the way it works so no need to worry even if end user has disabled the cookie.

To know how to use Forms Authentication, please read this article http://www.dotnetfunda.com/articles/article114.aspx. To know role based forms authentication, read this article http://www.dotnetfunda.com/articles/article141.aspx.

Hope this helps.

Best regards,

Hanishani, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response