PageMethods are to be used in aspx pages , not in MasterPage Methods. The only workaround is to create a seperate .asmx WebService and add your Logic in a static function . To Do so , right click on your solution on VS and click on Add New Item, Select WebService.asmx. in the code behind of the WebService write a static webMethod
[WebMethod]// press alt+shift+f10 after selecting the WebMethod wording to include the library
public static bool CheckLogin (string username, string password){
//Type your method here
return result;//Result should be Boolean
}
Now on your masterPage.master on client side script click event of the link, Post an Ajax Request to the webservice
$.ajax({
type: "POST",
url: "YourWebServiceName.asmx/CheckLogin",
data: '{"Username":"' + $('#username').val() + '","password":"' +
$('#password').val() + '"}',
dataType: "json",
contentType: "application/json; charset=utf-8",
success: function(message) {
alert(message);//will alert 'true'
//DO what you want to do on client side
},
error: function() {
alert(message);//will alert 'false'
//DO what you want to do on client side
}
});
Please let me know if you need any further clarification Have a nice day :)