2
I am building an Asp.net MVC application and make many calls to actions and webservices via ajax (jquery or Angularjs). How could I hide these calls, or ensure they are made only by my app?
For example:
$('#btnNext').click(function () {
$.ajax({
url: "/Home/Next",
type: "POST",
data: JSON.stringify({ 'Options': someData}),
dataType: "json",
traditional: true,
contentType: "application/json; charset=utf-8",
success: function (data) {
if (data.status == "Success") {
alert("Done");
} else {
alert("Error occurs on the Database level!");
}
},
error: function () {
alert("An error has occured!!!");
}
});
});
That way my code is very exposed. Anyone accessing the source will be able to call my actions and webservices without my permission and get my business data as well as load the server making numerous requests.
In Homecontroller you have no way of knowing if the user is logged in? If so, Actionresult Next returns, otherwise no.
– Andre Mesquita
I have no way of knowing if the user is logged in because it would be in an open area of the system
– Guilherme Ferreira