Ajax Sys.WebForms.PageRequestManagerServerErrorException - asp.net

A little background. I have a IIS8 server. Lets call this server ABC.
In server ABC. I have two website. One is called websiteA and websiteB. they are identical website. Only subtle differences since websiteB is primary used for test and dev purpose.
Can you please help me to troubleshoot the issue on WebsiteA?
The error is a generic error:
Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500
This error does not happen in WebsiteB. and I have compared the ASPX page to make sure they are exactly the same.
Can you help me how to troubleshoot the error 500 on the server? I don't know how...
This is the register Assembly for the ajax on top of the ASPX page:
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
This is the snippet for my toolkit
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" EnablePageMethods="True"></asp:ToolkitScriptManager>

Wow. I fixed this. So for kicks I start removing stuff from the page.
The first one I remove was this bit. because in less than 1 year ago I added this bit.
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
</ContentTemplate>
</asp:UpdatePanel>
Then I get a different error message:
I get this error now:
System.Web.HttpException: Maximum request length exceeded
Did some google of that error and boom! I get this stackoverflow link:
Maximum request length exceeded. I follow the suggestion and my problem goes away! Horray
and the solution is to add this in my web.config!
(the one in bold is the new stuff I added)
System.webserver is the new bit
and
executionTimeout="100000" maxRequestLength="214748364"
<configuration>
<system.web>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" executionTimeout="100000" maxRequestLength="214748364" />
<customErrors mode="Off"/>
</system.web>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1073741824" />
</requestFiltering>
</security>
</system.webServer>
</configuration>

Related

How do I encrypt the Telerik Rad Editor viewstate?

The viewstate or application's pages are already encrypted but looking at the Burp output of the response from a POST to the Telerik.UI.DialogHandler (ImageMananger) it seems the Telerik view state in the response appears not to be. See attached image.
Burp output
We've generated and specified the DialogParametersEncryptionKey, ConfigurationEncryptionKey, and ConfigurationHashKey keys in the site level web.config as described in article https://docs.telerik.com/devtools/aspnet-ajax/controls/editor/functionality/dialogs/security. This didn't change the viewstate.
The machine key in IIS is set for auto-generation.
I'm only assuming the Telerik viewstate can be encrypted because what I've read seems to imply that, but I haven't found a clear example so I'm not sure.
Can you please change the TargetFramework of the application to 4.5 or above and test again:
> <compilation debug="false" targetFramework="4.8" />
> <httpRuntime targetFramework="4.8" />
> <pages viewStateEncryptionMode="Always" enableViewStateMac="true">
> <controls>
> <add tagPrefix="telerik" namespace="Telerik.Web.UI" assembly="Telerik.Web.UI" />
> </controls>
> </pages>
> <httpHandlers>
It is also a must to set viewStateEncryptionMode="Always" enableViewStateMac="true" in the page directive or the web.config.
Check out this product forum thread for more information: https://www.telerik.com/forums/can-the-rad-editor-viewstate-be-encrypted.

RequiredFieldValidators issue in Asp.net

I am in the process of adding RequiredFieldValidators into my form and just tested it on the web and received this error
Error
WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for 'jquery'. Please add a ScriptResourceMapping named jquery(case-sensitive).
I added the solution which was this in the web.config file:
<appsettings> <add value="None" key="ValidationSettings:UnobtrusiveValidationMode"></add> </appsettings>
But that prompted this error
Error
HTTP Error 500.19 - Internal Server Error
This last error is saying something is wrong with the solution I inputted above.. Has anyone else ever run into this and have a solution?
Hope you have set targetFramework to 4.5 . The full config should look like this.
<configuration>
<appSettings>
<add key="ValidationSettings:UnobtrusiveValidationMode" value="None"></add>
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
</configuration>
If this key value is set to "None" [default], the ASP.NET application will use the pre-4.5 behavior (JavaScript inline in the pages) for client-side validation logic. If this key value is set to "WebForms", ASP.NET uses HTML5 data-attributes and late bound JavaScript from an added script reference for client-side validation logic.
Reminder: <appSettings> parent in the web.Config file should be the root element, that is <configuration>.
Helpful links - http://www.codeproject.com/Articles/465613/WebForms-UnobtrusiveValidationMode-requires-a
http://msdn.microsoft.com/en-us/library/system.web.ui.unobtrusivevalidationmode.aspx -- This says it a feature of v4.5, you should have to specify targetFramework = 4.5 in cofig to make it work.

Telerik RadChart ChartImage.axd 403

We use telerik radchart for charting in our app, we've been using it for some time and recently upgraded to 2013.2.717.40 in our app (which was the most recent version our expired subscription had).
Since then, we get a 403 error when using a chart image:
ASPX:
<%# Register Assembly="Telerik.Web.UI" Namespace="Telerik.Charting" TagPrefix="telerik" %>
<%# Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<telerik:RadChart ID="RadChart" IntelligentLabelsEnabled="True" runat="server" CssClass="RadChart" DefaultType="Spline" />
The web.config has:
<httpHandlers>
<add path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler" verb="*" validate="false" />
</httpHandlers>
and
<handlers>
<remove name="ChartImage_axd" />
<add name="ChartImage_axd" path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler" verb="*" preCondition="integratedMode" />
</handlers>
And I get a 403 permission denied on the url for the ChartImage.axd
The image is correctly created and cached in the appropriate temporary folder we've configured for use.
In processmonitor, as soon as that file is correctly written, the 403 failed request trace log file is created (we've enabled failed request tracing)
That file contains:
ModuleName IsapiModule
Notification 128
HttpStatus 403
HttpReason Forbidden
HttpSubStatus 0
ErrorCode 0
ConfigExceptionInfo
Notification EXECUTE_REQUEST_HANDLER
ErrorCode The operation completed successfully. (0x0)
I'm now at a loss.
I can't see anything being denied permissions and it looks like the web.config is set right for charting. If I take off the query string I get an error page as required parameters are missing, so the mapping appears to be working.
Any ideas?
The problem turns out to be that the Telerik RadChart when using image files on disk, as opposed to session storage (UseSession=False) does some checks on the path passed in for the temporary image directory, and the encrypted filename passed to ChartImage.axd to make sure you're not doing some hacking.
We were using:
/App/GeneratedImages
Which was causing the files to be written to the right place on disk, however, when the Telerik component checked this against the image path, they didn't match enough causing Telerik to throw a 403 itself.
I may or may not have determined this with the help of Reflector.
We changed to use:
~/GeneratedImages
Which made things work, I need to understand better why /App/GeneratedImages didn't map right. But for now Production is restored :)

Updated ASP.NET 3.5 to 4.0 -> Sys.WebForms.PageRequestManager is undefined

As the title indicates, I recently updated an ASP.NET 3.5 application containing UpdatePanels and similar AJAX technologies to ASP.NET 4.0. Unfortunately, the UpdatePanels work no more and full page postbacks makes it all go south.
Web.config-file
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="exceptionHandling" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration.ExceptionHandlingSettings, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling"/>
<section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging"/>
<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data"/>
</configSections>
<system.net>
<mailSettings>
<smtp>
<network host="localhost"/>
</smtp>
</mailSettings>
</system.net>
<system.web>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Forms">
<forms loginUrl="~/Login.aspx" name=".ASPXFORMSAUTH" defaultUrl="~/Administration/SystemEvents.aspx"/>
</authentication>
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace. -->
<customErrors mode="RemoteOnly" defaultRedirect="~/Error.aspx">
<error statusCode="401" redirect="~/Unauthorized.aspx"/>
</customErrors>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/></system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
</system.webServer>
</configuration>
Javascript error upon execution in Chrome:
Uncaught TypeError: Object function Function() { [native code] } has no method '_registerScript'
Uncaught TypeError: Cannot read property 'PageRequestManager' of undefined
What is there that I could've done wrong? Thank you!
Set EnablePartialRendering="false" in ScriptManager
I was having trouble with this recently as I was updating an older project and followed your steps above but it was still giving me the same error. I found that I needed to update a line in the web.config file which fixed it.
I changed:
<xhtmlConformance mode="Legacy"/>
to:
<xhtmlConformance mode="Transitional"/>
... and I've solved it myself by replacing the UpdatePanels and by removing the scripting managers.
I know this post is very old but the way I solved this problem its not given here.. So I thought its not bad to add one more way.
I tried doing
Set EnablePartialRendering="false" in ScriptManager
and it worked but then for every click the page was getting fully loaded which I didnt wanted.
so What I did is I just added a Line in Page_Load(). btnexport is button id.
ScriptManager.GetCurrent(Page).RegisterPostBackControl(btnexport);
I first tried it outside postback but my requirements were to export even after every dropdown click which was in update panel so the button wasnt working for that.
then when I put it inside postback... voila!! It worked like a charm.
So, you can put it outside or inside postback according to your requirements.
OR
One more solution - You can do this-
You might have forgot to add trigger inside asp:updatepanel like me.
Add this inside updatepanel and voila!!
<Triggers>
<asp:PostBackTrigger ControlID="btnexport" />
</Triggers>

Timeline .NET Error

I worked with the simile timeline a few years back and I am excited to see that it has moved into the .NET world. However, when I get it all set up and try doing the example on this site, I get an alert with this error:
"Failed to load data xml from /TimelineData.ashx?Dataid=4123ea6c-3c1b-482c-b8f6-24a9c2fe7465&type=rss
Not Found
It does load the timeline itself properly, but it doesn't load any dates from my codebehind or rss feed from the example. However, the test project worked as expected when I downloaded the latest source code. I didn't notice a file with the name TimelineData.ashx anywhere in the latest source code, and yet it ran fine. If I copy the cc1:Timeline directly from the Default.aspx file in the TimelineTest project, I get the same results, the above popup dialog error.
It kind of seems like support on their site has fallen off, I was just wondering if anyone out there is familiar with this control and could give me a hand?
I had the same problem.
The fix! IIS versions 7 and greater
put the handler in the system.webServer, NOT the system.web.
EDIT: formating.
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<add name="ashx" verb="GET" path="TimelineData.ashx"
Type="TimelineNet.TimelineAjaxHandler, TimelineNet"/>
</handlers>
</system.webServer>
Its seems that you did not have setup the web.config to accrept the ashx for time line
Read this page for details
http://timelinenet.codeplex.com/wikipage?title=Installation&referringTitle=Home
<configuration>
<system.web>
<httpHandlers>
<add verb="*" path=".ashx" type="TimelineNet.TimelineAjaxHandler, TimelineNet" validate="false" />
</httpHandlers>
</system.web>
</configuration>

Resources