1

In the page_load of page A I Server.Transfer to Page B (Server.Transfer("B.aspx");)

Then on page B I have a simple html button that has the onclick="ajaxFunction();";

function ajaxFuntion()
{
$.ajax({
        type: "POST",
        url: "B.aspx/MyPageMethod",
        data: "{}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        async: false,
        cache: false

    });
}

I get ajax error "Method not Found"

When I use Repsonse.Redirect instead of Server.Transfer, it works. But I need to use Server.transfer. Is there a fix here?

Thx

1 Answers1

1

I think it's because B.aspx renders in the context of A.aspx, and so it's not B.aspx you are currently in, it's A.aspx, as far as the browser is concerned. You can try A.aspx/MyPageMethod and see if it will work...

Brian Mains
  • 50,520
  • 35
  • 148
  • 257