ASP.NET Application lag after post back - asp.net

When running my application lately, there is a very long delay after a request is made to the server. When debugging and stepping through, the code finishes quickly and then a dialog comes up, which I'm assuming is the reason for the lag. (I've tried a series of other options including disabling usage of ViewState, disabling debugging, installing IE 8 and reinstalling the Ajax Control Toolkit.
The dialog reads as follows:
Find Source: ExtenderControlBase.cs
Original Location: C:\Users\swalther\Projects\AspNetAjax\Releases\30930\AjaxControlToolkitSource\AjaxControlToolkit\ExtenderBase\ExtenderControlBase.cs
This is strange, since I am not familiar with any user on this machine named swalther (it was reformatted rather recently) and searching my computer for this folder turns up no results.
As usual, any help would be greatly appreciated.

That reference to swalther refers to the developer who compiled the code in the first place.

Fixed. (Second time I've answered my own question - go figure. I'm creating a database of my bugs :) )
Changed this line:
<asp:ScriptManager ID="scriptManager1" runat="server" EnablePageMethods="true" />
to this:
<ajaxControlToolkit:ToolkitScriptManager ID="scriptManager1" runat="server" />
Looks like you have to use the ajax control toolkit script manager instead of the ASP version.

Related

Wired Update Panel Postback Issue

I have developed a web site and used update panel controls on all pages. The site was working fine and partial rendering was also working fine. But today update panel just stopped doing any post back. I don't know if this has anything to do with Performance Analysis, since I was experimenting with it yesterday.
I am using Asp.NET AJAX 3.5 framework, ToolkitScriptManager on all pages.
Things I tried doing.
1.) Reloaded Binary for AJAX Control Toolkit
2.) Tried to reload update panel
3.) Page methods within Update Panel seems to work. And Autocomplete Extender is working appropriately.
4.) I did backed up my code from few weeks back. It is working as expected. So I tried to copy web.config from my backup and checked it on latest code. Still not working.
Currently on any page whenever I select an item from a dropdownlist it is not doing a typical asynchronous postback and doesn't load other dependent dropdownlists.
Also update panel is not working on any of my pages. There seems to be an issue related to web.config but not sure though(I also added a new web config file but not working).
Any help in related to this would be appreciated.
Thank You.
I have solved this problem. Cause: I have written "Response.write()" in my master page. I was able to track in Chrome Console window and this was error: Uncaught Sys.WebForms.PageRequestManagerParserErrorException: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled. I removed response.write and it works as it was supposed to be.
Same thing as #Mitul but it was a Response.Redirect().
It works on localhost but not in production.
I added and works everywhere !
<asp:UpdatePanel runat="server">
<Triggers>
<asp:PostBackTrigger ControlID="lnkAddProduct" />
</Triggers>
The "lnkAddProduct" is a LinkButton in a Panel.

Viewstate Error in webpage

The following error occurs when my webpage is idle for more than 5 min.
Error: Sys.WebForms.PageRequestManagerServerErrorException: Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.
Source File: http://www.dial4jobz.com/ScriptResource.axd?d=Xl5p0QQ_qaR3K9bIVhwC3LyqjOX_oAKyeLj_-uS5j1VoFExVtm3XAHiq64EGJt04xntLJvh-9y3pvN3dvKgg5b6sQwkFvX7GT4f0aKn7iyc1&t=73e6f815
Dono, wat is the cause of this error.. I'll open a web page and after 5 min when I'm accessing it, it is showing this sort of error.. I don't hav any clue that why this error occurs.. Plz, give me any idea???
use the below code and try
<pages validateRequest="false" enableEventValidation="false" viewStateEncryptionMode ="Never" />
if u need more info kindly refer the link below,
http://blogs.msdn.com/tom/archive/2008/03/14/validation-of-viewstate-mac-failed-error.aspx
http://forums.asp.net/p/955145/1173230.aspx
I had the same issue, this is the two solutions I found and that might help if you are not using a WebFarm:
1. Disable ViewState MAC
On your page (.aspx) #Page directive you can add the attribute EnableViewStateMac="false". By doing this that will disable the check and then the issue will goes away.
Unfortunately Microsoft doesn't recommend to do this for security reasons:
This attribute should never be set to false in a production Web site,
even if the application or page does not use view state. The view
state MAC helps ensure the security of other ASP.NET functions in
addition to view state.
Source: Microsoft
2. Check HTML
There is a bug in ASP.Net causing this issue when the "action" attribute is set in your <form> tag. For example:
<form runat="server" action="page.aspx">
By removing this attribute that will remove the issue, so you should now have something like:
<form runat="server">
Obviously this solution may raise other issues, it depends on your application. One big problem is when using Ajax to load pages.
3. Avoid ViewStates
In some cases when using Ajax it could be very easy to get rid of ViewStates. You can send Ajax requests to your server for performing operations and then display the result, no need to use a ViewState. By doing this you won't have an issue about the ViewState validation.
I also found other suggestions on those pages that might help you if what said above doesn't fix your problem.
Hai vaishu,
Have a look at this validation-of-viewstate-mac-failed-error

JavaScript after deploying web application to IIS

I develop a web application which uses a lot of JavaScript. I developed first portion of code on my machine and everything works just fine. Problems occurred after deploying to remote machine to IIS - the page runs but i.e. whole validation that I wrote doesn't run - I've checked under FF, IE6, IE7.. Are there any IIS properties to set to make it run?
EDIT
I've just found out that the problem is here:
<script type="text/javascript">
function validate() {
return validateTrees();
}
</script>
The validate() function is called here:
<asp:Button ID="btnSubmit" CssClass="button" runat="server" OnClientClick="return validate();" Text="Send for approval" />
And validateTrees() function is loaded dynamically from .js file by the control:
<cust:CustomTreeControl ID="CustomTreeControl 1" runat="server" />
which is placed just before this submit button. It seems that after deploy the browser can't find validateTrees() function.
IIS shouldn't affect your JS in anyway (as long as the JS files are present and accessed properly).
Could you post some code examples of what you have (simple test cases, preferably) and what you expect it to do and what it isn't doing, and what, if any, errors you are getting.
IIS has nothing to do with this.
Your javascript files are downloaded by the browser on the client machine and runs there, not on the server.
Make sure you published your files correct.
Javascript typically runs on the client not the server. What makes you think this has anything to do with IIS?
Use a tool such as fiddler to confirm the browser is receiving all the content your expect.
Ok, that was silly, I didn't update paths to scripts after deployment.

ASP.NET broken rendering of Validation client side code in Firefox

This one has been a stumper for me. Its very easy to duplicate though a rather obscure issue. It came about as I was doing some javascript work on a web page yet also make use of the validation controls that ASP.NET provides.
Some specifics up front: using a Vista-based development machine with the 3.5 framework and IIS 7. I also have a QA machine that is running windows server 2003, also with the 3.5 framework but running IIS 6.
Take a page with a simple TextBox, Validation Control, and button to submit them. For example:
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Text is Required" ControlToValidate="TextBox1"></asp:RequiredFieldValidator>
<asp:Button ID="btnSubmit" runat="server" Text="Submit" />
Simple ASP.NET validation control code here ... The idea here is that client-side validation code is generated for the required field and a postback is not done unless the text box has a field. If the browser does not support client-side scripting, then ASP.NET will catch it on the server side using the Page.IsValid property.
When I run this from my Vista-based development machine, the client-side scripting code is generated for both IE and Firefox and works just fine.
When I run from the win2003-based QA machine, client side code for the validator controls is also generated for both browsers. The validation code for IE works fine ... but does Not work for Firefox. When the submit button is pressed (with an empty text box), the client-side code appears to be ignored and a postback performed. Now the validation error is caught server side - but I want to know why its not working client side in the first place.
The interesting quirk here is that if I take page source views under Firefox from the Development machine (the one that works) and the QA machine (the one that doesn't) and compare them - the client side validation code is dramatically different.
Ideas on what to change to get the client side validation code to work in Firefox with the QA machine?
UPDATE: Had a few comments asking to see the generated source. I've saved the Dev and QA source as .htm files and zipped them up. You can get them at http://www.optsolutions.com/testvalidation.zip
Check your web.config for xhtmlconformance and make sure it is not set to legacy.
http://aspadvice.com/blogs/rbirkby/archive/2006/11/01/Client_2D00_side-validation-in-Firefox.aspx
I am having the same issue with a similar setup. Differences in the browserCaps settings is the most promising possibility I have come across so far.
http://msdn.microsoft.com/en-us/library/sk9az15a(VS.80).aspx

'AjaxControlToolkit' is undefined Error

I am using the AjaxControlToolkit in VS2005, and it works fine. I do have some issues though, when I go to some pages I have, then click back, I get this JavaScript error:
'AjaxControlToolkit' is undefined
I have searched MSDN forums, and google, and tried many of the solutions, but none have worked. I have tried, EnablePartialRendering="true", and others. Short of rewriting everything and changing the workflow of my application, is there any way to find the root cause of this, or fix it?
­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
I got this problme fixed but not by setting CombineScripts="false" but by using the solution described in this post.
There have been some changes in the latest version, due to which you have to use Sys.Extended.UI.BehaviorBase instead of AjaxControlToolkit.BehaviorBase in the registerClass call.
To get around this 'AjaxControlToolkit' is undefined Error, you may also want to ensure that you have CombineScripts set to false in your ToolkitScriptManager configuration. This can be found in your Master page and this solution has worked for me.
<myTagPrefix:ToolkitScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" EnablePartialRendering="true" SupportsPartialRendering="true" **CombineScripts="false"**>
Note you will want to change myTagPrefix to the tagprefix you are using for AjaxControlToolkit. This is usually defined in asp at the top of an aspx file like this...
<%# Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="myTagPrefix" %>
This may be a silly question, but did you double check to make sure you have the toolkit reference at the top of your aspx file?
(Adding from comment for ease of reading)
Try adding this to your web.config
<system.web.extensions>
<scripting>
<scriptResourceHandler enableCompression="false" enableCaching="false" />
</scripting></system.web.extensions>
Is that a javascript error?
I suppose it has to do with back-button support in the toolkit.
And undefined errors mostly occurs because somehow the script that contains "AjaxControlToolkit" doesn't gets properly loaded.
Thing that come to mind:
The order scripts get loaded, does the Toolkit gets priority?
When there are errors in any of the loaded scripts all the other scripts that hasn't loaded yet will simply be canceled and not gets loaded.
See the outputted HTML of the problem page, find links to all the AXD files and make sure you can download them and see valid javascripts inside.
And if you don't already, get Firefox and Firebug and you should be able to trace to the actual script line that emits the error.
Hope this helps.
As [CodeRot] said you need to ensure you have all the AJAX web.config extensions in place, this is the most commonly missed point when doing ASP.NET AJAX sites (particularly from VS 2005).
Next make sure that you have a ScriptManager on the page (which I'm guessing you do from the "EnablePartialRendering" mention).
Make sure that you are referencing the AjaxControlToolkit version for your .NET version, it is compiled for both .NET 2.0 and .NET 3.5, and I believe the latest release is only supporting .NET 3.5.
Ensure that you're getting the Microsoft AJAX Client Library added to the page (that you're not getting any errors about "Sys" missing).
Ensure that you a registering the AjaxControlToolkit in either your ASPX, ASCX or web.config.
If nothing still hasn't worked out for you. Verify that you are not caching this ascx/aspx. Remove the OutputCache declaration.

Resources