SessionState lock problem

Discussion in 'ASP .Net' started by Alphapage, Mar 21, 2008.

  1. Alphapage

    Alphapage Guest

    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();
    Alphapage, Mar 21, 2008
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.