Where physically save WebService files in asp.net website?
What you prefer about saving Webservice files in asp.net website(not websiteapplication). I saved WebService files in App_Code\WS\somewebservice.asmx.cs.
And call method from this class with jquery.ajax
$("#btnMY").click(function() {
$.ajax({
type: "POST",
url: "App_Code/WS/ConstructorWS.asmx/HelloWorld",
data: "{}",
contentType:"application/json; charset=utf-8",
开发者_StackOverflow中文版 dataType:"jsondata",
success: function(msg) {
}
});
});
But firebug show error 403 Forbidden
I guess it's not possible to access files inside the App_Code folder. Try moving your web service to a different place (e.g. ~/WS/
) instead.
If you want, you can put the *.asmx file there and keep the *.asmx.cs files inside App_Code. In that case you need to edit the source of the *.asmx file and adjust the path to the *.cs file.
精彩评论