I have an ASP.Net page with a page method which accepts the username and password and开发者_StackOverflow validates the user. Since its a page method the username and password is sent to the server with the use of javascript in the usual way page methods are called.
Is it possible to set an authentication cookie in some way so that all subsequent page requests identify themselves as the logged in user? or isn't page methods the way to go when authenticating users?
You can set an authentication cookie with FormsAuthentication.SetAuthCookie.
Without knowing your specific needs (is this needing to be done on an AJAX request or not) you can call it in any code behind method as normal.
精彩评论