Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > SessionState lock problem

Thread Tools

SessionState lock problem

Posts: n/a
Hello, Ajax doc tells that the previous request is cancelled. But in my
example code, it doesn't seems to be.
When I click on Button1, the page sleeps during 20s and if I click quickly
on Button2, the response arrives (label2 is displayed) after 20s.
I know the problem is about SessionState which is in locked state.(ie if I
add EnableSessionState="False" to the @Page directive, label2 is updated
How can I set Button1 to request EnableSessionState="False" and Button2 to
request EnableSessionState="True" ?
Have I to build a custom HttpHandler ?
If so, thanks in advance to tell me the way.

Here is my code:

<%@ Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs"
Inherits="WebApplication1.WebForm2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

<html xmlns="" >
<head runat="server">
<title>Untitled Page</title>
<script type="text/javascript">

function pageLoad() {

<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<asp:Button ID="Button1" runat="server" Text="Button1"
onclick="Button1_Click" />
<asp:Button ID="Button2" runat="server"
Text="Button2" />
<asp:Label ID="Label1" runat="server"
<asp:Label ID="Label2" runat="server"

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace WebApplication1
public partial class WebForm2 : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)


protected void Button1_Click(object sender, EventArgs e)
Label1.Text = "end sleeping";

protected void Button2_Click(object sender, EventArgs e)
Label2.Text = "test updated:"+DateTime.Now.ToLongTimeString();
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Read-Write Lock vs primitive Lock() k3xji Python 7 12-30-2008 10:19 PM
Application.Lock()/UnLock() or lock(Application) nano2k ASP .Net Web Services 2 08-09-2007 09:31 AM
Threading - Why Not Lock Objects Rather than lock the interpreter Fuzzyman Python 3 12-05-2003 10:43 PM
RE: Threading - Why Not Lock Objects Rather than lock theinterpreter Robert Brewer Python 0 12-05-2003 05:33 PM
Who can help me with this simple webform problem?? (SessionState) Flemming Jensen ASP .Net 0 08-22-2003 05:39 AM