Velocity Reviews - Computer Hardware Reviews

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

Reply
Thread Tools

SessionState lock problem

 
 
Alphapage
Guest
Posts: n/a
 
      03-21-2008
Hello,

Asp.net 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
quickly).
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"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<script type="text/javascript">

function pageLoad() {
}

</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Button ID="Button1" runat="server" Text="Button1"
onclick="Button1_Click" />
<asp:Button ID="Button2" runat="server"
onclick="Button2_Click"
Text="Button2" />
<asp:Label ID="Label1" runat="server"
Text="Label1"></asp:Label>
<asp:Label ID="Label2" runat="server"
Text="Label2"></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>

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)
{
System.Threading.Thread.Sleep(20000);
Label1.Text = "end sleeping";
}

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

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



Advertisments