Showing posts with label dropdownlist. Show all posts
Showing posts with label dropdownlist. Show all posts

Saturday, March 24, 2012

PageRequestManagerServerErrorException when using UrlMappings

Hi,

I think I found a bug and I would like some help about a workaround.

I have a page with DropDownList inside an UpdatePanel. The page path is /physicalfolder/physicalpage.aspx

 
1 <form id="form1" runat="server">2 <asp:ScriptManager ID="ScriptManager1" runat="server" />3 <asp:UpdatePanel ID="PanelRecherche" runat="server" Visible="true" UpdateMode="Conditional">4 <ContentTemplate>5 <table><tr> <td>6 <asp:DropDownList ID="dropDownList1" runat="server" AutoPostBack="true" OnSelectedIndexChanged="dropDownList1_SelectedIndexChanged"/>7 </td></tr> </table>8 </ContentTemplate>9 </asp:UpdatePanel>10 <button type="submit">Go</button>11 </form>

In the code behind I do nothing except adding items to the DropDownList

1protected void Page_Load(object sender, EventArgs e)2 {3if (!Page.IsPostBack && !ScriptManager1.IsInAsyncPostBack)4 {5 dropDownList1.Items.Add("1");6 dropDownList1.Items.Add("2");7 }8 }910protected void dropDownList1_SelectedIndexChanged(object sender, EventArgs e)11 {1213 }

And finally in the web.config file I've set some UrlMappings

1<urlMappings>2 <add url="~/virtualfolder/virtualpage.aspx" mappedUrl="~/physicalfolder/physicalpage.aspx"/>3</urlMappings>

The problem is the following: when usinghttp://localhost/mysite/physicalfolder/physicalpage.aspx everything works fine, I can play as much as I want with the DropdownList.

If I use the vrtual pathhttp://localhost/mysite/virtualfolder/virtualpage.aspx only the first postback works fine, after that I get an error :

--------
Microsoft Internet Explorer
--------
Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 404
--------
OK
--------

If I look at the http requests:

    To access the page the first timehttp://localhost/mysite/virtualfolder/virtualpage.aspxOn First index change http://localhost/mysite/physicalfolder/physicalpage.aspxOn next index changes http://localhost/mysite/virtualfolder/physicalpage.aspx

Funny thing is that if I use the submit button before doing something else, it works like a charm.

Any ideas ? I can't remove UrlMapping and I need AjaxCrying


Ok, found it by my self, I was using wrong search patern.

Added this code right after closing form:

1 <script type="text/javascript">2 Sys.Application.add_load(function()3 {4 var form = Sys.WebForms.PageRequestManager.getInstance()._form;5 form._initialAction = form.action = window.location.href;6 });7 </script>

PageRequestManagerTimeoutException on terminal servers?!

Hello all,

I made a webform application with ajax. You have to log in and when authenticated you can navigate to a page which contains a dropdownlist. When you select something in this dropdownlist, it executes an ajax callback to the code-behind. (It shows a turning GIF-file and does the needed methods.) It works fine, no errors.
When I connect with remote desktop to a computer and I browse to this site, all works fine.

Now comes the tricky part:
When I connect with remote desktop to a terminal server and try to browse to this site, the server can find the site, I can do a 'login', but when I select something from this
dropdownlist, it throws immediately a Sys.WebForms.PageRequestManagerTimeoutException.

I know you can set the timeout of an asynchronous callback in de scriptmanager tag, but it contains already "36000".

I already googled, but I didn't encounter a problem like this one. (because the terminal server makes it somewhat different)

If someone can help me with this problem, I would be very gratefull!

Kind regards!

Marc Meers

Hi,MarcMeers

The problem can happen 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 or the server cost a long time to hander a request. 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 http://forums.asp.net/t/1114130.aspx

Hope this helps.


Hello Jin-Yu Yin,

Thank you for the effort you have made.

But, we have found the problem.
Someone changed the MTU value to a lower value than normally used.

We changed it back to the default values, all worked fine after it...

Thanks!

Case closed...