Our application had some issues when users would excessively click around the page without waiting for the page to post back. To prevent that from happening we used following approach. Please feel free to comment on validity of this technique in general:
private void BaseApplication_PreRequestHandlerExecute(object sender, EventArgs e) { if (Context.Handler is IRequiresSessionState || Context.Handler is IReadOnlySessionState) { Mutex mx = (Mutex) this.Session["MUTEX_LOCK"]; if (mx != null) { mx.WaitOne(); } } } void BaseApplication_Error(object sender, EventArgs e) { if (Context.Handler is IRequiresSessionState || Context.Handler is IReadOnlySessionState) { Mutex mx = (Mutex)this.Session["MUTEX_LOCK"]; if (mx != null) { mx.ReleaseMutex(); } } } private void BaseApplication_PostRequestHandlerExecute(object sender, EventArgs e) { if (Context.Handler is IRequiresSessionState || Context.Handler is IReadOnlySessionState) { Mutex mx = (Mutex) this.Session["MUTEX_LOCK"]; if (mx != null) { mx.ReleaseMutex(); } } } In VS2005 (2.0 framework) and IIS6 on Server 2003 above code worked perfectly. I am testing waters with Windows Server 2008, IIS7 and 3.5 framework. In this environment above code causes random lockups. I can usually get through maximum of 3..5 postbacks before session is locked up and new browser window needs to be opened. Can anyone explain why this happens with IIS7/3.5 ? Thank you! =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com