I have the following scenario - and what I'm really looking for is real help from real people. Suggestions / solutions? You are welcome.
I have an extranet website, for example. www.foo.com (asp.net 3.5) I use jQuery 1.3.2 to call ValidateLogin PageMethods on the default.aspx page (www.foo.com/default.aspx)
The code will look like this:
$.ajax({ type: "POST", contentType: "application/json; charset=utf-8", dataType: "json", url: "Default.aspx/ValidateLogin", data: '{' + arg + '}', success: function(data) { if (data.d != 0) { window.location = "http://www.google.com"; } else { alert("Invalid UserName/Password."); ResetLoginForm(); } }, error: function(xhr, status, error) { var strerror = xhr.status + error; alert("Error Communicating with Server:" + strerror); ResetLoginForm(); } });
The code is stored in an external js file. For ex default.js.
Since this site is publicly available, anyone can download the default.js file and thus take a look at the code above.
My question is: one day the user will receive this URL: "Default.aspx / ValidateLogin", he can make a request to the server, and the server will proudly respond to the request.
What are my options here? How can I check the request? How to prevent these unauthorized requests?
source share