InterviewSolution
| 1. |
How do you implement Forms authentication in MVC? |
|
Answer» Authentication is to give ACCESS to the user for a specific service by VERIFYING his/her identity using his/her credentials like USERNAME and password. After IIS authentication, ASP.NET form authentication occurs. We can configure forms authentication by using forms element in web.config. The default attribute values for forms authentication are shown below, <system.web> <authenticationmode="Forms"> <formsloginUrl="Login.aspx" protection="All" timeout="30" name=".ASPXAUTH" path="/" requireSSL="false" slidingExpiration="true" defaultUrl="default.aspx" cookieless="UseDeviceProfile" enableCrossAppRedirects="false" /> </authentication> </system.web>The FormsAuthentication class CREATES the authentication cookie automatically when SetAuthCookie() or RedirectFromLoginPage() methods are called. The value of an authentication cookie CONTAINS a string representation of the encrypted and signed FormsAuthenticationTicket object. |
|