开发者

Call to PageMethod blocks until complete; prevents client or server-side redirect

开发者 https://www.devze.com 2023-02-06 06:26 出处:网络
I\'m calling a static Page method via javascript that takes between 5s and 10 min. I\'d like to give my user the choice to either continue waiting for the request to complete or not, and use window.se

I'm calling a static Page method via javascript that takes between 5s and 10 min. I'd like to give my user the choice to either continue waiting for the request to complete or not, and use window.setTimeout() to check back every 30s.

I've tried both location.href = '/newpage.aspx' or firing a button's click handler (which does similar redirect) to redirect the user prior to completion of the page method, to no avail. I can immediately send user to a simple html page, but a redirect to any aspx page involving server-side appears to block. When the page method finally completes, the redirect does succeed.

Is this:

  • a browser issue? If all modern browsers support at least 2 concurrent requests per domain, why wouldn't this work?
  • a framework limitation?
  • a desirable design pattern or even possible? I've checked, and after redirecting to an HTML page, the original request continues processing (db updates, no problem).

Are Page method calls simply not asynchronous from 开发者_高级运维a "concurrent HTTP request" perspective?

Any insight greatly appreciated!


It sounds like you're blocking on InProc Session, which is limited to one concurrent request per unique session. If you don't need access to the Session in your page method, you can disable it by modifying the WebMethod attribute:

[System.Web.Services.WebMethod(EnableSession=false)]
0

精彩评论

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