19

I'm occasionaly getting the following popup from an AJAX.NET application

Sys.WebForms.PageRequestManagerServerErrorException: An Unknown error occurred while processing the request on the server. The status code returned from the server was: 12031

From the Microsoft kb that status code indicates a ERROR_INTERNET_CONNECTION_RESET, but it doesn't state what was the underlying issue the triggered the error in the first place.

How can I log/trace/etc the underlying error that generated the popup?

Rob Cooper
  • 28,567
  • 26
  • 103
  • 142
bastos.sergio
  • 6,684
  • 4
  • 26
  • 36

6 Answers6

21

If you're getting that from an updatePanel, set EnablePartialRendering to false in the ScriptManager for the page, and then it should give you the actual error.

Also, if it only happens occasionally, I've found that it could be a viewstate problem, especially when the page goes a long time (20mins or so) between refreshes.

Otherwise, try some try/catch blocks. Those are some easy methods.

Hope that helps!

Zachary Yates
  • 12,966
  • 7
  • 55
  • 87
  • 1
    "set EnablePartialRendering to false" helped me find the error, thanks! – Homer Jul 28 '10 at 15:34
  • If you are using Chrome, open dev tools and watch the console. The error also shows up there without having to change your code. – Induster Apr 11 '13 at 15:25
  • @Induster good point! If you look at the "network" tab for any red requests (http error codes), click the request then click the "preview" tab, you can see the error page as well – Zachary Yates Apr 16 '13 at 19:39
  • Thank you so much. This property helped me identify the real error. Chrome tools pointed to a generic serialization error in the whole object I was passing through view state. Setting this property to false told me that the error was in a member of the object which was missing the Serializable attribute. – Carlos Nuñez Aug 19 '13 at 23:57
15

It's a viewstate problem, but not related with time but with size. Try playing with maxRequestLength in your web.config.

penyaskito
  • 511
  • 2
  • 5
  • 16
  • Thanks for pointing me in the right direction. I was finally able to fix the problem by writing the ViewState to the DB, instead of sending it in the page to the browser. – bastos.sergio Jun 03 '09 at 14:04
2

add <httpRuntime requestValidationMode="2.0"/>
in web.config and in YourPage.aspx set (ClientIDMode="Static" ValidateRequest="false")

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

EXAMPLE: web.config

   <?xml version="1.0"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <system.web>
    <httpRuntime requestValidationMode="2.0"/>
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
      </assemblies>
    </compilation>

  </system.web>


  <connectionStrings>
    <add name="WT_ZadnjiEntities" connectionString="metadata=res://*/DAL.Model.csdl|res://*/DAL.Model.ssdl|res://*/DAL.Model.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=SATELLITE-PC;initial catalog=WT_Zadnji;integrated security=True;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>
</configuration>
hari
  • 21
  • 1
1

I've got this error in UpdatePanel with autopostback Dropdown after big delay (>20 min) between change dropdown selection.

Try increase session timeout in web.cofig. For example:

<sessionState mode="InProc" cookieless="true" timeout="720"/>;
CoolBeans
  • 20,654
  • 10
  • 86
  • 101
Sergii.PSP
  • 71
  • 4
0

sometimes the error occurs if you have added a server SSL certificate(https).If the certificate is not valid it will give this error.

alice7
  • 3,834
  • 14
  • 64
  • 93
0

I had the following error happening on postback:

Error: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server.

But for me, the issue was that I am converting my project from ASP.NET 2.0 to ASP.NET 4.0 and I had <asp:UpdatePanel runat="server"> used on the page.

I took off the <asp:UpdatePanel runat="server"> (for the time being), then ran the page to get the exact error. Which was "A potentially dangerous Request.Form value was detected"

I found that even though I have ValidateRequest="false" on the page, ASP.NET 4.0 requires you to add requestValidationMode="2.0" in the HttpRuntime tag of web.config.

<httpRuntime maxRequestLength="102400" requestValidationMode="2.0"/>

Reference

Scott
  • 21,211
  • 8
  • 65
  • 72
Neha
  • 1