cs0815
cs0815

Reputation: 17428

asp.net forms authentication + jquery get requests

Let us say the user is successfully 'cookie asp.net form authenticated'. (S)he can now perform a get request via action A of controller B. Let us say this returns HTML to the user's browser. This HTML contains some jquery code that performs a GET request to a action that also requires authentication (e.g. after the user hits a button). Is the jquery GET request automatically authenticated as the user is logged in and has a cookie? Hope this makes sense.

If not, what is the best way to check, if the request was a ajax one during the authentication/authorisation (e.g. in a filter attribute). Thanks!

Upvotes: 1

Views: 639

Answers (1)

Thomas
Thomas

Reputation: 1197

APS.NET Forms authentication uses a cookie like most any web authentication.

The cookie will be tied to the domain your requesting.

So ajax or regular request are all just HTTP requests (usually GET or POST) all requests to the server (depending on http headers) will include the cookie as part of the request.

How you implement the security on the server side is up to you.

Upvotes: 2

Related Questions