Harindaka
Harindaka

Reputation: 4898

Set Authentication Cookie via ASP.Net Page Method. Possible?

I have an ASP.Net page with a page method which accepts the username and password and 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?

Upvotes: 0

Views: 1593

Answers (1)

Frazell Thomas
Frazell Thomas

Reputation: 6111

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.

Upvotes: 2

Related Questions