开发者

Sys.WebForms.PageRequestManagerParserErrorException: What is the difference between normal rendering and partial rendering?

开发者 https://www.devze.com 2023-01-06 18:14 出处:网络
I am creating a proxy server in c#. I made it working except in case of partial postbacks. During partial postback, it is throwing exception saying

I am creating a proxy server in c#. I made it working except in case of partial postbacks. During partial postback, it is throwing exception saying


Message from webpage

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.

Details: Error parsing near '

<!DOCTYPE html P'.


OK

The application is working fine when I am trying to access directly. The error occurs when I access through my proxy server. The common causes, the error metions are not there in the application, since it is working fine while accessing directly.

There are some differences that I don't know between normal and asynchronous postbacks. When I debug, I could not find any difference between a normal and partial postback. From the error I know, the proxy server is returning the whole p开发者_运维问答age html instead of returning the UpdatePanel html only.

Can anybody help how to make it working?

My proxy server application is basically listening on a particular port for any httprequest and based on the HttpListenerRequest it gets, it creates a HttpWebRequest and sends the request to the original web application. Then it receives the HttpWebResponse and creates a HttpListenerResponse from that and sends it to the browser.

My code is based on the code given in http://www.codeproject.com/KB/IP/reverseproxy.aspx

Thanks in advance


I found the solution for the problem. There are some difference between the normal HttpListenerRequest and the partial HttpListenerRequest. Actually frame adds a Header called "x-microsoftajax". While you are creating the HttpWebRequest, you have add this Header also. This will solve ParserError, but it will redirect you to the Login Page, if you are using Forms Authentication. By adding the "Cookie" header from the HttpListenerRequest to your HttpWebRequest you can solve this issue too.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号