/_layouts/MyProject/MyPage.aspx/MyMethod
in your example is equivalent to:
http:
it's your problem. starting with / means the beginning at the root. You must adjust this. If this has to be somehow dynamic, because it can be used in several places, you may need to use codebehind to enter a path or something else. If it always starts from a static location, just change the URL.
If the page from which you use it is, for example:
http://server/sites/xxx/Somepage.aspx
Then just change it to
_layouts/MyProject/MyPage.aspx/MyMethod
without a slash.
If you are in a subfolder, for example:
http://server/sites/xxx/Pages/Somepage.aspx
You can do it:
../_layouts/MyProject/MyPage.aspx/MyMethod
the .. will lead you to one folder.
source share