Click to See Complete Forum and Search --> : Web Response sent to wrong Client
WeePecky
May 6th, 2008, 07:51 PM
Hi,
I have written an application that sends pager messages to pagers.
The application is running on IIS6, is written in C#, and uses the Microsoft ASP.NET 2.0 AJAX Extensions v 1.x.
Selection of the pager numbers is AJAX enabled to provide a smoother user experience.
The Submit/Send button sits outside of the UpdatePanel and is not AJAX enabled.
When the user submits, if another user has submitted at the same time, the response indicating a successful or unsuccessful submission is returned to the wrong client.
For example:
Sarah submits a message to pager 222.
Fred submits a message to pager 444.
Fred receives the message pager sent ok to 222.
Sarah receives the message pager sent ok to 444.
I have disabled the AJAX portion of the web page and this has had no effect.
Anyone have any idea what is going on?
Thanks in advance.
Wee!
dglienna
May 6th, 2008, 08:01 PM
Sorry. The crystal ball is in for repairs this week. Check back later, or provide some code, please! :)
WeePecky
May 6th, 2008, 09:56 PM
Well hows that... found the problem...after 4 months looking...
You don't want the code ... really you don't...
Answer might be obvious to those initiated in .NET
Removed the following line from the web page:
<%@ OutputCache Duration="1" VaryByParam="None" %>
Problem gone. Go figure. I'm heading back to newbie heaven.
Thanks
Wee!
dglienna
May 6th, 2008, 10:17 PM
well, the goal is to help the next person
WeePecky
May 7th, 2008, 07:13 PM
Your absolutely correct:
I was trying to find the solution to this problem in the Code behind (C# code). I stumbled on another discussion which indicated that the default response of programmers is to look at the code, not the xml.
First suspecting the session ID was not being honoured I changed the configuration to display the Session ID in the query string. This indicated that the Session ID was being honoured. I then started to work through the XML attributes, and when checking the documentation of the OutputCache directive thougth that caching on the server side (which is what this does, apparently) would not be a good thing if two users hit the server concurrently.
I removed the line indicated below and the problem disappeared.
Possible implications of removing this tag: unknown - maybe it will only mean the application works. If it breaks again I will post here.
What interested me most, is this code was autogenerated. I did not put it there (I had no idea what it did) so it was never on my radar.
Cheers
Wee!
Code follows:
Main Page
<%@ Page Language="C#" AutoEventWireup="true" EnableViewState="true" CodeFile="Quickpage.aspx.cs" Inherits="_Default" %>
<%@ Register Src="Paging.ascx" TagName="Paging" TagPrefix="uc1" %>
<!-- Removed this line - No idea if there are any implications to this or not
<%@ OutputCache Duration="1" VaryByParam="None" %>
< --
<!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 id="Head1" runat="server" >
<title>Quickpage</title>
<link rel="SHORTCUT ICON" href="Images/pager.ico" />
<link href="Style\StyleSheet.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript">
function fieldLengthCheck(fieldName, strValue, maxLength) {
//Determines how long a string is and prevents the user entering any more characters once max length characters is reached.
spanCounter.innerText = strValue.length;
if (strValue.length > maxLength)
{
var str = fieldName.value;
fieldName.blur();
fieldName.value = str.substr(0,100);
strValue = fieldName.value;
spanCounter.innerText = strValue.length;
fieldName.focus();
}
}
</script>
</head>
<body id="body">
<form id="form2" runat="server">
<asp:ScriptManager ID="ScriptManager2" runat="server" />
<div class="title"><img src="Images/QuickPage.BMP" alt="Quickpage"/></div>
<uc1:Paging ID="Paging1" runat="server" />
</form>
</body>
</html>
Components Paging.aspx
<%@ Control Language="C#" AutoEventWireup="true" EnableViewState="true" CodeFile="Paging.ascx.cs" Inherits="Components_Paging" %>
<%@ Register Src="UserLogin.ascx" TagName="UserLogin" TagPrefix="uc2" %>
<asp:UpdatePanel ID="Paging" runat="server" >
<ContentTemplate>
<asp:Label ID="lblSearch" runat="server" CssClass="lblSearch" Text="Find:"></asp:Label>
<asp:TextBox ID="txtSearch" runat="server" CssClass="txtSearch" TabIndex="1" ></asp:TextBox>
<asp:Button ID="btnSearch" runat="server" CssClass="btnSearch" OnClick="btnSearch_Click"
Text="Find" TabIndex="2" />
<asp:Label ID="lblSearchResults" runat="server" CssClass="lblSearchResults" Text="Click to select:"></asp:Label>
<asp:ListBox ID="SearchResults" runat="server" CssClass="SearchResults" OnSelectedIndexChanged="SearchResults_SelectedIndexChanged"
Rows="10" TabIndex="3" ></asp:ListBox>
<br />
<asp:Label ID="lblAddPager" runat="server" CssClass="lblAddPager" Text="Pager no:"></asp:Label>
<asp:TextBox ID="txtAddPager" runat="server" CssClass="txtAddPager" TabIndex="4"></asp:TextBox>
<asp:Button ID="btnAddPager" runat="server" CssClass="btnAddPager" OnClick="btnAddPager_Click"
TabIndex="5" Text="Add" /><asp:Label ID="lblPagerNo" runat="server" CssClass="lblPagerNo" Font-Bold="False"
Text="Recipients: "></asp:Label>
<asp:ListBox ID="txtPagerNo" runat="server" CssClass="txtPagerNo" OnSelectedIndexChanged="txtPagerNo_SelectedIndexChanged" ></asp:ListBox>
<asp:Label ID="lblRemovePager" runat="server" CssClass="lblRemovePager" Font-Bold="False"
Text="Click to remove."></asp:Label><br />
<asp:Label ID="lblSendMessageText" runat="server" CssClass="lblSendMessageText" Font-Bold="False"
Text="Message: (maximum of 100 characters)"></asp:Label>
<asp:TextBox ID="txtPagerMessage" runat="server" CssClass="txtSendMessage" onkeyup="fieldLengthCheck(this,this.value,100);"
TabIndex="7" MaxLength="100" OnTextChanged="txtPagerNo_SelectedIndexChanged" TextMode="MultiLine"></asp:TextBox>
<asp:Label ID="txtSearchError" runat="server" CssClass="txtSearchError" ForeColor="Red"></asp:Label><br />
<div id="spanCounter" class="lblCount"></div>
<asp:Label ID="txtAddPageError" runat="server" CssClass="txtAddPageError" ForeColor="Red"></asp:Label><br />
<asp:TextBox ID="txtPagerList" runat="server" CssClass="txtPagerList"></asp:TextBox> <br />
<asp:Label ID="lblChangeContact" runat="server" CssClass="lblChangeContact" Text="Pager change requests should be sent to the XXXXXXXXXXXXXXXX Telephonists."></asp:Label>
</ContentTemplate >
</asp:UpdatePanel>
<uc2:UserLogin id="UserLogin" runat="server">
</uc2:UserLogin>
<asp:Label ID="txtError" runat="server" CssClass="ERROR" ForeColor="Red"></asp:Label><asp:Label ID="txtSuccess" runat="server" CssClass="txtSuccess"></asp:Label><br />
<asp:Button ID="btnSendMessage" runat="server" AccessKey="1" CssClass="btnSendMessage"
OnClick="btnSendMessage_Click" TabIndex="8" Text="Send" />
<asp:Button
ID="btnRemove" runat="server" CssClass="btnRemove" OnClick="btnRemove_Click"
Text="Remove" TabIndex="6" />
Component UserLogin.aspx
<%@ Control Language="C#" AutoEventWireup="true" EnableViewState="true" CodeFile="UserLogin.ascx.cs" Inherits="Components_UserLogin" %>
<asp:Label ID="txtUserLogin" runat="server" CssClass="UserLogin"></asp:Label>
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.