开发者

asp.net forms authentication Global.asax and ajax calls

开发者 https://www.devze.com 2023-02-27 09:29 出处:网络
I\'m using forms authentication in my current asp.net web forms application \"not MVC\" and wondering if Global.asax [Application_AuthenticateRequest] and [Application_PostAuthenticateRequest] invoked

I'm using forms authentication in my current asp.net web forms application "not MVC" and wondering if Global.asax [Application_AuthenticateRequest] and [Application_PostAuthenticateRequest] invoked on every request to the server or Not? i mean does ajax calls count for Global.asax handling or some bugs might occur! because i found in this link conflict:

http://channel9.msdn.com/开发者_StackOverflow中文版forums/TechOff/256322-Strangeness-between-ASPNET-AJAX-and-Globalasax/

so please advice if its good or bad to handle custom authentication for ajax calls through Global.asax

thanks,


AJAX calls back to your application are just the same as hitting the site with the browser so yes these events will be fired.

The article you link to concerns the scenario where you have more than one request made within the same session.

http://msdn.microsoft.com/en-us/library/ms178581.aspx

Access to ASP.NET session state is exclusive per session, which means that if two different users make concurrent requests, access to each separate session is granted concurrently. However, if two concurrent requests are made for the same session (by using the same SessionID value), the first request gets exclusive access to the session information. The second request executes only after the first request is finished.

So if you made two requests back to your application from ajax code running in the browser they would be executed one after the other, not in parallel.

There is no way to turn this feature off.

In ASP.NET MVC3 it is possible to create sessionless controllers that do permit multiple ajax requests in the same session to be serviced at the same time by decorating the controller with this attribute:

[SessionState(SessionStateBehavior.Disabled)]
0

精彩评论

暂无评论...
验证码 换一张
取 消