FormsAuthentication.SetAuthCookie in OnAuthorization of custom attribute

Posted by Prasad on Stack Overflow See other posts from Stack Overflow or by Prasad
Published on 2009-11-21T06:07:43Z Indexed on 2010/05/15 23:10 UTC
Read the original article Hit count: 332

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?

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about forms-authentication