Tuesday, May 17, 2011

Fix It: Sys.WebForms.PageRequestManagerParserErrorException when using update Panel in Facebook Apps

Hi All,

I was developing a Facebook application using Facebook C# SDK and i have an update panel in my page i'd like it to update a grid in it based on selected index changed event for a drop down list.

The problem is that i have the update panel was throwing an exception when i was trying to change the selected index of a drop down list, the error is :
Sys.WebForms.PageRequestManagerParserErrorException when using update Panel

This error is vague, to know exactly what is the problem of the update panel, Install Fiddler which is the best tool for any web developer should have to inspect http requests/responses.

After installing and open Fiddler to inspect all http round trips on my development machine, I found the actual error that was returned from the server is:
Given URL is not allowed by the Application configuration.
So the solution for this problem is a missing or incorrect configuration in your Facebook application. Open the configuration of your Facebook application and select website tab and set the website url for your local Facebook application is running:
Site URL : http://localhost/

Tips:
1) If you set the port number in the site url this won't fix the problem, Just set the localhost without any ports and this will fix the update panel problem is not updating because of the javascript error.
2) You can have SelectedIndexChanged event as AsyncPostBackTrigger in the update
panel and no issues with this because i read some posts were saying it has to be SyncPostBack
which is not actually right.
Hope this helps.


Regards,
Mostafa Arafa
twitter.com/mostafaelzoghbi

No comments: