WebMethod with EPiServer pages

Vote:
 

Hello, 

I have a problem with my webmethod using an episerver PageTemplate.

If I browse the page localhost/Views/Pages/myPage.aspx   and from this page click the button to execute my c# method it works properly.

However, if I browse the page localhost/en/myfriendlyurl   and click the same button, the post return a 404 page not found error.

Below my code:

in myPage.aspx i enabled the pageMethod

and add the script

function test() {

PageMethods.Register("a string", "another sting", true, true, onSucess, onError);

function onSucess(result) {
//alert('Success');
}

function onError(result) {
alert('Something wrong.');
}

}

The backend code I added the WebMethod attr.

[WebMethod]
public static void Register(string s1, string s2, bool b1, bool b2)
{
....
...

}

What's wrong?

#118281
Mar 03, 2015 19:38
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.