FormsAuthentication.SetAuthCookie in OnAuthorization of custom attribute
- by Prasad
I am trying to set an auth cookie in OnAuthorization of my custom attribute in asp.net mvc(C#) application.
when the session expires(New Session), i am setting an auth cookie again to make it available until the users logout.
I have used the following to set the auth cookie,
//set forms auth cookie
FormsAuthentication.SetAuthCookie(strUserName, true);
But when i check HttpContext.User.Identity.IsAuthenticated, it returns false.
How to set an auth cookie in OnAuthorization of custom attribute?