I am using Form Authentication and sending an Aajx request to the server for authentication. Based on the json result, the client decides where to go and what to do. That is the
FormsAuthentication.SetAuthCookie
Method Creates an authentication ticket for the supplied user name and adds it to the cookies collection of the response, or to the URL if you are using cookieless authentication.
Ref: msdn
Have a look at the Forms Authentication Control Flow. The authentication cookie is set to the response cookie collection, and should be observable at the http protocol level (e.g. use FireCookie or Fiddler2 to verify this).
Membership only verifies a username/password. Neither Membership nor SetAuthCookie()
will modify the current request. They expect to send the cookie back to the caller, and the next request is when the properties like IsAuthenticated
will return true.
Note that you can override and extend these automatic processes using custom IIdentity
and IPrincipal
, and hook into the authentication events if you need to.
Also have a look at Using Forms Authentication with ASP.NET AJAX