Showing posts with label time. Show all posts
Showing posts with label time. Show all posts

Wednesday, March 28, 2012

Ajax UpdatePanel PageRequestMangerServerErrorException Problem

Hello and thank you for the opportunity to post my questions. I am having a heck of a time with the Ajax UpdatePanel.

My problem is as follows:

Everything works fine until there is some period of inactivity by the user (typically 2-3 minutes) and then when the user attempts to edit a row they receive the following message:

Sys.WebForms.PageRequestMangerServerErrorException: An unkown error occured while processing the request on the server. The status code returned from the server was:500

I have tried using the code listed below with the UpdatePanel UpdateMode Property using values of Conditional and Always with the same result.

What am I missing here? Do I need to add additional code to handle ViewState issues associated with the UpdatePanel?

Any assistance would be greatly appreciated! Thank you.


CODE USED:
<%@dotnet.itags.org. Page Language="VB" AutoEventWireup="true"
CodeFile="Default.aspx.vb" Inherits="_Default"
buffer="true" enableSessionState="true"
enableViewState="true" %>

<%@dotnet.itags.org. Register Assembly="AjaxControlToolkit"
Namespace="AjaxControlToolkit"
TagPrefix="ajaxToolkit" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Ajax Example</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False" AutoGenerateEditButton="True" DataKeyNames="ID"
DataSourceID="SqlDataSource1" GridLines="None" PageSize="20">
<Columns>
<asp:CommandField ShowSelectButton="True" />
<asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" ReadOnly="True" SortExpression="ID" />
<asp:BoundField DataField="LastName" HeaderText="LastName" SortExpression="LastName" />
<asp:BoundField DataField="FirstName" HeaderText="FirstName" SortExpression="FirstName" />
<asp:BoundField DataField="Type" HeaderText="Type" SortExpression="Type" />
<asp:BoundField DataField="Class" HeaderText="Class" SortExpression="Class" />
<asp:BoundField DataField="Status" HeaderText="Status" SortExpression="Status" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConflictDetection="CompareAllValues"
ConnectionString="<%$ ConnectionStrings:MyConnectionString %>"
UpdateCommand="UPDATE [Master] SET [LastName] = @dotnet.itags.org.LastName, [FirstName] = @dotnet.itags.org.FirstName,
[Type] = @dotnet.itags.org.Type, [Class] = @dotnet.itags.org.Class, [Status] = @dotnet.itags.org.Status
WHERE [ID] = @dotnet.itags.org.original_ID AND [LastName] = @dotnet.itags.org.original_LastName AND
[FirstName] = @dotnet.itags.org.original_FirstName AND [Type] = @dotnet.itags.org.original_Type AND
[Class] = @dotnet.itags.org.original_Class AND [Status] = @dotnet.itags.org.original_Status">
<UpdateParameters>
<asp:Parameter Name="LastName" Type="String" />
<asp:Parameter Name="FirstName" Type="String" />
<asp:Parameter Name="Type" Type="String" />
<asp:Parameter Name="Class" Type="String" />
<asp:Parameter Name="Status" Type="String" />
<asp:Parameter Name="original_ID" Type="Int32" />
<asp:Parameter Name="original_LastName" Type="String" />
<asp:Parameter Name="original_FirstName" Type="String" />
<asp:Parameter Name="original_Type" Type="String" />
<asp:Parameter Name="original_Class" Type="String" />
<asp:Parameter Name="original_Status" Type="String" />
</UpdateParameters>
</asp:SqlDataSource>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>

Try to set EnableEventValidation="false" in <%@. Page %> tag..

see results if it solves the problem...


Thank you for taking the time to respond to my question. Yes I did try that and no it did not work. I also tried EnableViewStateMac = False and other suggestions outlined in Microsoft's Knowledge Base Article # 829743 entitled "Troubleshooting the "View State is invalid" error with ASP.NET" with no success either.

I have tried searching the blogs and other sites of interest releated to Ajax. The only post which I have seen that comes the closest to addressing this issue ishttp://www.openjs.com/articles/ajax/session_timeout.php but it addresses generic Ajax and not the flavor supported by Microsoft.

Due to the fact that I am brand new to using Ajax of any kind, I tried posing on this site to attempt to find an anwser to this vexing problem.

Thank you again for taking the time to respond to my post.


Thanks...I read the article about session_timeout...

Have you tried any other solution...


Hello again. Yes, I have tried a number of things. One method that appears to work is putting a timer on the page and setting the tick for every 2 minutes or so. When the timer reaches the alarm point, it refreshes the page. The problem seems to go away. However, using this type of method could have serious performance issues if deployed accross a large number of sites and pages being hosting on the same server.

So there definately is a relationship with this problem and the viewstate. By causing the page to refresh it resets the viewstate. There must be some value caused by the async postback(s) that is offending the validation at the server a some later time. It could also be releated to the fact that the session on the server has expired and it can't find anything to refer to so it blows up.

I love being a developer but sometimes stuff like this just drives me nuts!

Any thoughts you would like to add?

Thanks for your interest in helping to solve this problem for me.


Hiwindyman42

This happens when the machineKey used to encrypt/decrypt the viewstate was changed, and more likely this will happen if you keep the page idle for a long time. To avoid this, you need to have a static machineKey.

Check this articlehttp://blog.g9th.com/2007/01/14/unable-to-validate-data-at-systemwebconfigurationmachinekeysectiongetdecodeddata.aspx

Let me know if you need more info.
You can also see this thread for more help:http://forums.asp.net/t/1115331.aspx

Thanks


Thanks Jin-Yu Yinfor providing the more details...Smile


Thank you for your response! I appologize for the delay in responding but I wanted to fully test your suggestion before replying to your post. I am very pleased to report that your suggestion does in fact FULLY FIX THE PROBLEM! The only thing that is a little puzzling however is that one of the links you provided (The Experts) said that making the MACViewState value = False has the same effect as providing a static machine key. I had tried this ealier but it was unsuccessful.

Thank you both for taking the time to provide assistance. I hope to return the favor in kind sometime in the future.

Ajax Update Panel and Update Progress

Hello Everyone,

Its been long time since i have visited this forum, but i have a query regarding the update panel. I have a strange and weard situtaion here, which is only occuring on the web hosting server and it works absolutely fine on VSS (Local) server.

The situation is i have an application where Web User Controls are placed on the web page at the design time, they are made Visible true/false at the run time. The Page where controls are placed contains the update panel and the User controls Indvidually too contains the Update Panel. These update Panel are associated with update Progress control. Now the situation is that on web hosting server when a postback is made or the data is bieng fetched on the control there is Update Progress control displaying the image as it should be, but the thing which should not happen is that the next control which should be displayed now is not visibletill i move my mouse cursor ,which is absolutely strange. This this is absolutely driving me crazy, as this thing works absolutely fine on my local server but not on Web server. It could be observed that processing for server code has been done as GIF Image stops moving after the server side coding has been processed, and untill you move your mouse cursor the page will not be rendered.Crying Could any one help me out this situation

Best Regards

Is there no one who cam help me on this regard......Crying


Hi,Piyushg

I am afraid we cannot find out the exact root cause without further information captured when this strange problem occurs.

To troubleshoot this issue, we really need the source code to reproduce the problem, so that we can investigate the issue in house. It is not necessary that you send out the complete source of your project. We just need a simplest sample to reproduce the problem. You can remove any confidential information or business logic from it.

Thank you.

Ajax update panel and the drop down list

Hi all,

Im using the update panel but have got into a spot of bother.

I've used the update panel many times before with buttons, but this time i need to use an update panel so that when a drop down list has its index chasnged that certain panels are shown and certain panels are hidden.

The problem i'm encountering is that the page does the post back, ive tried various options and tried to find decent examples on the next but everything is either with a checkbox or using a button.

on my page.aspx.cs i have the

1protected void dropTaxCertType_SelectedIndexChanged(object s, EventArgs e) {23UpdateCertView();45//UpdatePanel1.Update();6}78protected void UpdateCertView() {910//SortedList answers = this.AnsweredQuestions;11//DropDownList ddl = (DropDownList)sender;12//answers[ddl.ToolTip] = ddl.SelectedValue;13//this.AnsweredQuestions = answers;1415if (dropTaxCertType.SelectedValue =="0") {16pnlCert.Visible =false;17pnlRefNo.Visible =false;18}19else if (dropTaxCertType.SelectedValue =="1000") {20pnlRefNo.Visible =true;21pnlCert.Visible =false;22}23else if (dropTaxCertType.SelectedValue =="n/a") {24pnlRefNo.Visible =false;25pnlCert.Visible =false;26}27else {28pnlCert.Visible =true;29pnlRefNo.Visible =false;30}3132//if (ScriptManager1.IsInAsyncPostBack ){33// string callbackString = Map1.CallbackResults.ToString()34// ScriptManager1.RegisterDataItem(Map1, callbackString)35//}36}
 
as you can see from the above code ive tried various optinos from seeing it on the web with no success.
At first i created my updatepanle and inserted the ddl into it, but i kept getting this javasript error saying ambigous match found.
 
so i put the ddl outside the update panel, but because i have the autopostback it keeps posting back like a normal page without
update panel, but if i take out the autopostback the panls that are supposed to change dont. 
 
<table class="tLayout5"><tr class="top"><td colspan="2"><br /><hr /><br /><br /><strong>CIS Tax Certificate Type:</strong><br /><asp:DropDownList ID="dropTaxCertType" OnSelectedIndexChanged="dropTaxCertType_SelectedIndexChanged" AutoPostBack="true" CssClass="frmWidth99" runat="server"><asp:ListItem Text="" Value="0"></asp:ListItem><asp:ListItem Text="Subcontractor Certifying Document" Value="1000"></asp:ListItem><asp:ListItem Text="CIS4 - Registration card - must pay net" Value="CIS4"></asp:ListItem><asp:ListItem Text="CIS5 - Corporate certificate - can pay gross" Value="CIS5"></asp:ListItem><asp:ListItem Text="CIS6 - Photocard certificate - can pay gross" Value="CIS6"></asp:ListItem><asp:ListItem Text="CIS65 - Temporary registration - must pay net" Value="CIS65"></asp:ListItem><asp:ListItem Text="Exempt or Non Applicable" Value="n/a"></asp:ListItem></asp:DropDownList><br /></td></tr></table><asp:UpdatePanel ID="UpdatePanel1" updatemode="conditional" runat="server"><ContentTemplate><asp:Panel ID="pnlRefNo" runat="server"><table class="tLayout5"><tr class="top"><td colspan="2"><label for="txtUniqueRefNo"><strong>Unique Reference Number:</strong></label><br /><asp:textbox id="txtUniqueRefNo" MaxLength="30" runat="server" CssClass="frmWidth99" /></td></tr></table></asp:Panel><asp:Panel ID="pnlCert" runat="server"><table class="tLayout5"><tr class="top"><td colspan="2"><label for="txtOtherTaxCertType"><strong>Other:</strong></label><br /><asp:textbox id="txtOtherTaxCertType" MaxLength="30" runat="server" CssClass="frmWidth99" /></td></tr><tr class="top"><td style="width:49%;"><label for="txtTaxCertNr"><strong>CIS Tax Certificate Number:</strong></label> <br /><asp:textbox id="txtTaxCertNr" MaxLength="50" runat="server" CssClass="frmWidth99" /><asp:RegularExpressionValidator ID="RegularExpressionValidator7" Enabled="true" ControlToValidate="txtTaxCertNr" Display="Dynamic" runat="server" Text="Invalid Number" ValidationExpression="\w{1,20}" /></td><td style="width:49%;"><label for="radDate_dateInput_TextBox"><strong>Expiry Date:</strong></label>(dd/mm/yyyy)<radcln:raddatepicker id="radDate" MinDate="1980-01-01" AllowEmpty="true" Runat="server"><PopupButton style="float: left" /><DateInput DisplayPromptChar="_" PromptChar=" " onclick="ToggleStartDatePopup()" Width="100px" style="float: left" /></radcln:raddatepicker><asp:RequiredFieldValidator runat="server" ID="rfvDate" ControlToValidate="radDate" InitialValue="1980-01-01" Text="Required!" /><br /></td></tr></table></asp:Panel><Triggers> <asp:AsyncPostBackTrigger ControlID="dropTaxCertType" /> </Triggers></ContentTemplate></asp:UpdatePanel>
 I hope someone can help me pleaseeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
 
many thanxz in advance
 
Zal
 
 
 
Try with the triggers tags outside the contentTemplate tags.

I've tried your code without this lines:

<radcln:raddatepicker id="radDate" MinDate="1980-01-01" AllowEmpty="true" Runat="server">
<PopupButton style="float: left" />
<DateInput DisplayPromptChar="_" PromptChar=" " onclick="ToggleStartDatePopup()" Width="100px" style="float: left" />
</radcln:raddatepicker>
<asp:RequiredFieldValidator runat="server" ID="rfvDate" ControlToValidate="radDate" InitialValue="1980-01-01" Text="Required!" />

with DropDownList inside UpdatePanel, and works fine.


That was probably because you aren't using the RadCalendar when you tried that code or it wasn't set up the same. The drop down wasn't triggering the update outside the update panel because the trigger tags need to be at the same level at the content template tags, not nested.

Monday, March 26, 2012

AJAX Toolkit Tabs

Is this the intended effect withthe tab control

I notice that each time i roll over a tab (other than the front active one) it makes a call to the server

TIA

i noticed exactly the same thing...

a tab (other than the front active one) it makes a call to the server...

even with the simple code below...

<ajaxToolkit:TabContainer runat="server" ID="TabContainer2">

<ajaxToolkit:TabPanel runat="server" ID="TabPanel4" HeaderText="TabPanel1">
<ContentTemplate>
TabPanel1
</ContentTemplate>
</ajaxToolkit:TabPanel>

<ajaxToolkit:TabPanel runat="server" ID="TabPanel5" HeaderText="TabPanel2" Enabled="true">
<ContentTemplate>
TabPanel2
</ContentTemplate>
</ajaxToolkit:TabPanel>

<ajaxToolkit:TabPanel runat="server" ID="TabPanel6" HeaderText="TabPanel3">
<ContentTemplate>
TabPanel3
</ContentTemplate>
</ajaxToolkit:TabPanel>
</ajaxToolkit:TabContainer>

i noticed it makes call to server...

Ajax timercontrol - ie6 freezes with high cpu over long period of time

Hi,

I'm using Ajax for ASP.NET (2.0) on a project. In this project I use the ajax timer control to refresh contents of an update panel.
The panel refresh happens every minute. (the content of the panel consists of information that is pulled out of a database).

All works fine so far, except that I noticed to have big issue with my pages. The page with the timer & updatepanel is opened continously for literally days. (so we could speak of long user sessions), and each minute it is refreshing.

When loaded in ie6 (I didn't try another browser, but ie6 is still the standard in my company, so no other choices), after a while, I start noticing a constant CPU load on the iexplore.exe process, and I don't mean during refresh, just while the page is static & not updating/refreshing. It starts of at 0%, then after half an hour, it's at 1%, a bit later 2% and so on...
After lots of hours (like one working day), I end up with an internet explorer session that is continously using as much CPU as it can have. And most of the time, ie6 just got frozen and isn't doing anything.

This is so bad. I made sure I stopped the timer before doing the updating & then restart the timer to avoid any problems in this area, but it still exists.

Did anyone notice this as well? Is there some kind of cure for it? Or am I doing anything wrong here?

Thanks!!

Here's a related post:http://forums.asp.net/p/1009453/1367209.aspx

-Damien


As suggested in that topic I have moved the ajax timer control & the progress bar out of the update panel, I have set the update panel trigger to the timer tick event.

I also disable the timer before refreshing & enable it again afterwards:

protected void tmrRefresh_Tick(object sender, EventArgs e)
{
tmrRefresh.Enabled =false;
((BasePage)Page).Refresh();
tmrRefresh.Enabled =true;
}

The timer interval is set at 1 minute

still I have this increasing CPU load (really little, but it exists) over time, like + 1% every hour (just when the page is static).

What is going on here? Any help?

EDIT: I'd like to add that all things mentioned in the topic you posted belong to the atlas extensions. I'm not using those, I'm using the Ajax 1.0 extensions...


Atlas was the pre-release name of ASP.NET AJAX 1.0; much of the content still holds true...

Your problem sounds like this issue is a leak with IE6 and JavaScript; did you try with IE7?

-Damien


I know that Atlas preceded Ajax extensions, I only wanted to make sure what I was using. I can imagine some stuff was changed from Atlas to Ajax...
As told in my initial post, ie6 is still the standard browser in our company, so trying ie7 will not help me.

But... I created a very simple ajax enabled web application today with just a timer that refreshes a text label every 5 seconds. The label held the current date & time.
I let it run for half a day and no constant CPU load whatshowever.

Does this mean that the increasing CPU stuff is hiding somewhere else, in the refresh procedure of my project?
If so, then why does a client gets a constant CPU load even when the page is not refreshing.
I thought the only thing that would happen on client side was waiting for the next timer tick... or am I wrong?


I don't know who accepted Damien's post as answer, but this problem is still open and I have yet to find a solution...Surprise

Saturday, March 24, 2012

Ajax timer update does not work when it updates a text box with some special characters

The Ajax time seems to have some trouble updating a panel that contains a text box with some special characters. I managed to replicate the problem using a very simple page that is inlcuded below. The problem is that the second update causes an error 500 from the development server of Visual Studio.

The page just has an update panel with a single multi-line text box. The code for the timer update assignes the text box the string "<br>\n".

Does anyone know how to solve this problem?

The Page is:

<%@dotnet.itags.org. Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server" /> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:TextBox ID="TextBox1" runat="server" TextMode="MultiLine"></asp:TextBox> <asp:Timer ID="Timer1" runat="server" Interval="5000" OnTick="Timer1_Tick"> </asp:Timer> </ContentTemplate> </asp:UpdatePanel> </form></body></html>
The code for the update is:

public partialclass _Default : System.Web.UI.Page {protected void Page_Load(object sender, EventArgs e) { }protected void Timer1_Tick(object sender, EventArgs e) { TextBox1.Text = "<br>\n;"; }}

Regards,

Ivan

By the way, I do realize that the problem is with special characters that trigger the ASP.NET security validations. Changing the text in the Text Box to HTML encoded is not an option, because in this text box the user should be entering and editing HTML code.

ajax timer problem

Hi..
Iam using Ajax Enabled website in my Project iam using two Ajax Timer controls for displaying
two images in different time one for 5 seconds another for 2 seconds but it is displaying only one image

have you used two update panels for two timer controls?
Try updating panel, once one image is displayed. Then enable another timer.

i.e

timer1.enabled=true;
timer2.enabled=false;

timer1_tick() {
//display image

timer1.enabled=false;
timer2.enabled=true;
updatepanel.update() //if updatemode is set to conditional
}

timer2_tick() {
//display image

timer2.enabled=false;
updatepanel.update() //if updatemode is set to conditional

}


Hi,

I used two update panels for two timer controls then also its not working

protectedvoid HomeImages(object sender,EventArgs e)

{

if (n > 13)

n = 1;

if (n != 4)

{

Image1.ImageUrl =String.Concat("Dimages/image", n.ToString(),".jpg");

}

Image1.ImageUrl ="Dimages/images" + n.ToString() +".jpg";

n++;

homeImages.Enabled =false;Timer1.Enabled =true;

UpdatePanel1.Update();

}

protectedvoid Timer1_Tick3(object sender,EventArgs e)

{

if (k > 6)

k = 1;

Image3.ImageUrl =String.Concat("ClientsImages/clientimage", k.ToString(),".jpg");

// Image1.ImageUrl = "Dimages/images" + n.ToString() + ".jpg";

k++;

Timer1.Enabled =false;

UpdatePanel2.Update();

}


Hi Pathipati,

I have made a sample for your situation. Please wholly copy my source code and have a test.

<%@. Page Language="C#" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server">public static bool timer1State = false; public static bool timer2State = false; protected void Timer2_Tick(object sender, EventArgs e) { if (timer2State) { Image2.ImageUrl = "~/pic/expand.jpg"; } else { Image2.ImageUrl = "~/pic/collapse.jpg"; } timer2State = !timer2State; UpdatePanel2.Update(); } protected void Timer1_Tick(object sender, EventArgs e) { if (timer1State) { Image1.ImageUrl = "~/pic/expand.jpg"; } else { Image1.ImageUrl = "~/pic/collapse.jpg"; } timer1State = !timer1State; UpdatePanel1.Update(); }</script><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional"> <ContentTemplate> UpdatePanel1:<%=DateTime.Now.ToString()%> <asp:Image ID="Image1" runat="server" ImageUrl="~/pic/expand.jpg" /> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick"/> </Triggers> </asp:UpdatePanel> <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional"> <ContentTemplate> UpdatePanel2:<%=DateTime.Now.ToString()%> <asp:Image ID="Image2" runat="server" ImageUrl="~/pic/expand.jpg"/> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="Timer2" EventName="Tick" /> </Triggers> </asp:UpdatePanel> <asp:Timer ID="Timer1" runat="server" Interval="5000" ontick="Timer1_Tick"> </asp:Timer><asp:Timer ID="Timer2" runat="server" Interval="2000" ontick="Timer2_Tick"> </asp:Timer> </form></body></html>

Best regards,
Jonathan

Ajax Timer is causing Page_Load every time that it fires.

Hi,

I have an Ajax Timer on my page, which fires every 3 seconds. When it fires, if approriate, it will bind a datatable to a gridview (which is inside an update panel) and change the text of a label (which is in a different update panel); otherwise it will do nothing.

The timer works and completes its tasks correctly but everytime it fires it also causes the Page_Load method to fire. This is causing problems because the formatting of the gridview is then changed.

I hope someone is able to help!

Thanks

Matt

This is just how it is. When the timer event is raised, it will cause Page_Load to fire, then the Timer_Tick event, similar to how events typically work in a standard ASP.Net page postback. The difference is that the request is being delivered asynchronously to the server via XML and javascript.

If you have code in Page_Load that you don't want executing every time, look to using IsPostback to limit them to executing only on the initial Page_Load.


like mentioned above, thats how it works, and checking the page_load function to see if you posted back is a good way to help fix this. Try code like this

if(!IsPostBack){//Put all the code here that you want to run only on //the first time the page loads}//Everything outside of that if will run everytime there is a postback

Hi, thanks for that.

I have actually used the "!IsPostBack" statement to limit what code fires. But even when there is nothing with in the Page_Load method the GridView (in the update panel) is still being reloaded.


is the update panel set to always update, if so try putting it to conditional


keyboardcowboy:

is the update panel set to always update, if so try putting it to conditional

No, that doesn't help.

I think that the Gridview is being rendered (not sure if this is the correct term) at Page_Load.

Is there any way to limit when a gridview can be rendered?


I think that if the gridview and the timer are in the same updatepanel, then the gridview will re-render. If this is the case for you, then try moving the timer into a separate updatepanel and ensuring that UpdateMode="Conditional" is set for the gridview updatepanel.

Jason


Hi,

As a matter of fact, a partial request and a normal request will both make the requested page experiences a normal life cycle. So, page_load method will be fired in both cases.

You can distinguish it via ScriptManager1.IsInAsyncPostBack property.

Hope this helps.

Ajax time zone bug

there appears to be a bug in the ajax client code. First, try this in javascript:

var testDate = new Date();

var testDateString = testDate.localeFormat("yyyy-MM-ddTHH:mm:ss.fffffffzzz");

I'm in New York, so the value of testDateString = "2007-10-12T12:10:56.34534+4:00" or something like that.


now try doing this in c#

DateTime testDate = DateTime.Now;

testDateString = testDate.toString("yyyy-MM-ddTHH:mm:ss.fffffffzzz");

in this case, the value of testDateString is equal to something like: "2007-10-12T12:10:56.34534-4:00"

now to see some real fun, add this to the above Javascript:

var messedUpDate = Date.parseLocale(testDateString, "yyyy-MM-ddTHH:mm:ss.fffffffzzz");

you'll find that the messed up date is not equal to the original test date. however in c#

DateTimemessedUpDate = Date.ParseExact(testDateString,"yyyy-MM-ddTHH:mm:ss.fffffffzzz",CultureInfo.CurrentCulture.DateTimeFormat);

will yield a date equivalent to testDate.

Is this a bug? or am I misusing/misunderstanding the localeFormat method?

Hi,

I think parseLocal create a date from a localized date string. I think it works only when you do the followings (it is from the documentation):

Remarks

Use the pareseLocale function to create anobject of type Date from a string. If you provide no custom formats,this function uses theSys.CultureInfo.CurrentCulture property to determine the culture value.

To create a date from a locale-specific string that uses the current culture, set theEnableScriptGlobalization property of theScriptManager control totrue. You must also modify settings in the Web.config file so that theculture attribute of the<globalization> section is set toauto.


I don't think this is a localization problem. As you can see by the results of running my code, all the strings do parse correctly as dates, the problem is that the resulting dates are incorrect.


Ok, I see.

First test:

var testDate = new Date();
var testDateString = testDate.localeFormat("yyyy-MM-ddTHH:mm:ss.fffffffzzz");
window.alert( testDateString ); //2007-10-17T10:11:16.0310310-02:00 <-- good
var messedUpDate = Date.parseLocale(testDateString, "yyyy-MM-ddTHH:mm:ss.fffffffzzz");
window.alert( messedUpDate ); //Wed Oct 17 200714:11:16 GMT+0200 (Central Europe Daylight Time) <-- total wrong!!!

Second test:

var testDate = new Date();
var testDateString = testDate.localeFormat("yyyy-MM-ddTHH:mm:ss.fffffff");
window.alert( testDateString ); //2007-10-17T10:13:32.5155155 <-- good
var messedUpDate = Date.parseLocale(testDateString, "yyyy-MM-ddTHH:mm:ss.fffffff");
window.alert( messedUpDate ); //Wed Oct 17 2007 10:13:32 GMT+0200 (Central Europe Daylight Time) <-- also good

Maybe localFormat and parseLocal don't like time zone formatting?!


The issue on the timezone offset was a bug in the javascript date formatting, and will be fixed in the next release. The reason for the discrepancy between parse and format was that parsing didn't have the same bug.

Ajax time out error 122002

Hi all,

I am try to perform a long running operation and using ajax. It takes about 10 min for the script to finish off but in the mean time I get an unspecified ajax error . I think this is a time out error. How can this be rectified.

hello.

if you're using udaptepanels, you can set the asyncpostbacktimeout property to define the timeout interval.


Hi,

I am not using ATLAS framework. I am just using the XMLHttpRequest object. Is there any way that I can set the timeout property or is there any way that I can ping the client to say that the server is processing the data.

AJAX Time entry control

Are there any slick AJAX controls available that would allow a user to select a valid time i.e. 4:20PM? If so then how could I incorporate two of those controls to populate a text box with the time difference between the two values. So Control1 = 4:20PM ; Control2 = 4:30PM ; Textbox1 = 10minutes.

Thanks in advance.

http://www.asp.net/learn/ajax-videos/video-131.aspx

I found a good tutorial that pretty much solves my request to validate Time data entry. It uses the MaskedEdit control and the MaskedEditValidator control.

Now I just have to find the VB command that will do the arithmetic.


Nice one.

Vij

Wednesday, March 21, 2012

AJAX Slow Startup Time for First Request

Hi,

After quite a bit of hunting around posts I'm stuggling to find any issues that seem to match our performance issues that appear to only target startup and not actual application performance.

We have a Web Application Project (Visual Studio 2005 SP1) using AJAX that is deployed onto IIS 6 and each time after the worker process is recycled the first request is taking (on average) 20 seconds to complete. Each additional request thereafter is completing in under 2 seconds.

All of the assemblies deployed onto the server are release build assemblies and the debug option within the web.config file is set to true. We are not seeing any issues with the time or amount of data being transferred to the client browser after the first request.

After some extra digging we have discovered that without any reference to System.Web.Extensions within the web.config (effectively removing AJAX from the application) the first request after the worker process is recycled is completing within 3 seconds. And, subsequently adding in the appropriate AJAX references causing the first request to return to taking 20 seconds to complete.

What does adding the System.Web.Extensions references into the Web.Config cause ASP.Net to do on startup? I'm more than happy to accept that there is going to be some additional cost, however, an additonal 15-17 seconds is a large leap.

Is there anything that we can do to minimise this lengthy startup time?

Thanks in advance of any assistance.

With ASP.Net, the first request will always take longer. There is the overhead of JIT compiling for the requested app. One of the ways you can cut this down is to use pre-compilation for your website.

If you are releasing 'release' versions of your dlls, you shouldn't need debug set to true. Setting this to false could also help with speed.


I have the same problem.

AJAX.NET take sometime to load and also Infragistics WebGrid takes about 15 seconds to load.


I understand that there will always be an overhead for a first request.

My concern isn't an ASP.Net problem, but rather an AJAX problem. Our application without any AJAX functionality is able to comlete it's first request in under 3 seconds, however, as soon as we attempt to include AJAX into the application (with no other changes) the first request is now taking 20 seconds to complete.


Regardless of any other application settings, the only one that seems to make it any slower is including the AJAX web.config settings.


We are also facing same issue. Please do let me know if you have managed to resolve this issue.


So far the only workaround we have applied for this issue is to modify the IIS 6 application pool details to prevent the worker processes from recycling as often as they do by default. This is not a long term workaround, but has helped for us as we do not have any memory/performance issues with our application running over long periods of time.


I'll be sure to post here again if we do discover an appropriate solution.


I'll try to set the IIS 6 Application Pool as you wrote.

Thanks!


Hi, we are still trying to solve this problem with the System.Web.Extensions assembly.

We made severals tests and finally today we noticed one thing. We have set up a virtual machine with a clean Windows 2k3 installation, IIS, ASP.NET 2.0 and AJAX Extension.

We found that if this virtual machine is not connected to the network, the assembly load in less than a second, but when we have connected it to the network the startup time was around 20 seconds.

Can anybody test this?

Does anybody have some ideas about how to solve this problem?

Thanks.


After a bit of testing we found a work around for this problem

We installed on our virtual machine a network sniffer and an empty WebSite with only the reference to System.Web.Extensions assembly.

We noticed that during the startup, our machine was trying to connect to the IP address (131.107.115.28) responding to crl.microsoft.com.

We added this line to our hosts file (C:\Windows\System32\Drivers\etc\):

127.0.0.1 crl.microsoft.com

and restart IIS.

Well, our application now takes less than 2 seconds to startup.

Hope you'll find this helpful!Cool


What the hell was it doing that for? Bill? You got some explaining to do!


Dbdj:

After a bit of testing we found a work around for this problem

We installed on our virtual machine a network sniffer and an empty WebSite with only the reference to System.Web.Extensions assembly.

We noticed that during the startup, our machine was trying to connect to the IP address (131.107.115.28) responding to crl.microsoft.com.

We added this line to our hosts file (C:\Windows\System32\Drivers\etc\):

127.0.0.1 crl.microsoft.com

and restart IIS.

Well, our application now takes less than 2 seconds to startup.

Hope you'll find this helpful!Cool

Has anyone else tried this? and did it help?


found this:

That is Microsoft's certificate authority server (CRL stands for "Certificate Revocation List"), which is used to verify whether the certificate for an application (or website) is legitimate or not. Microsoft applications have certificates associated with them and they can be check for validity at crl.microsoft.com.

Here's a relate thread:

http://www.wilderssecurity.com/showthread.php?t=15867

Here's a basic definition for CRL in general terms. You can search Google using "Certificate Revocation List" and find a lot more information.

http://encyclopedia.thefreedictionary.com/Certificate%20Revocation%20List

Now, you could try disabling the check in IE for "publisher's" certificate revocation, that is probably what's causing these particular connections. (IE > Tools menu > Internet Options... > Advanced tab > scroll down to Security section and look for "Check for publisher's certificate revocation" - is it checked?)


We tried to run our application with and without that option but there was no difference. So we decided to work on the "hosts" file.


After my ASP.NET website sits idle for more than 20 mins the next request is very slow. The reason is that the application domain is flushed from IIS and the application needs to be recompiled. I found this utility to be handy.http://www.spikesolutions.net/ViewSolution.aspx?ID=c2b7edc0-5de1-4064-a432-05f6eded3b82