help.axcms.netAxinom Logo
Save Save Chapter Send Feedback

KB10004: *.aspx not found when using asynchronous postbacks

"Page not found" error after asynchronous postback result when using ASP.NET AJAX on AxCMS

SYMPTOMS

When using ASP.NET AJAX on AxCMS page all postbacks after asynchronous postback result in "Page not found" error or "PageRequestManagerServerErrorException"

CAUSE

When ASP.NET AJAX does asynchronous postback, it also rewrites form action to the one it receives as postback response from server.

As result, the action becomes “<page>.aspx”, while before it was “publish/<page>.aspx”.

SOLUTION

1) Insert this code to your page template after <asp:ScriptManager> tag:

<script type="text/javascript">
actionUrl = document.forms[0].action;
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(restoreFormAction);
function restoreFormAction(sender, args)
{
document.forms[0].action = actionUrl;
document.forms[0]._initialAction = actionUrl;
}
</script>

or


2) Always check your page's Page_Load method wheather your request URL contains "/publish/" or not. If it does not, then do a postback and make sure that it contains it.

(That means: Request to .../YourAjaxPage.YOUREXTENSION must be automatically redirected to .../Publish/YourAjaxPage.aspx ).

APPLIES TO

AxCMS.net versions: before 9.0