i have this simple ajax call from client-side : this is in the TestPage.aspx
<%@ Page Language="C#"%>
<%@ Import Namespace="System.Web.Services" %>
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>Piece Of Cake </title>
<link rel="stylesheet" type="text/css" href="../css/navigation.css">
<link rel="stylesheet" type="text/css" href="../css/form.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
<script type="text/javascript" src="../javascript/validateForm.js"></script>
<script type="text/javascript" src="../javascript/effects.js"></script>
<script>
$(document).ready(function () {
$.ajax({
type: "POST",
url: "TestPage/GetName/",
contentType: "application/json; charset=utf-8;",
dataType: "json",
success: function (response) {
alert("success")
},
failure: function (response) {
alert("failure")
},
error: ErrorOccur
});
});
function ErrorOccur(data, status, req) {
alert("error:"+req.responseText + " " + status);
}
</script>
</head>
now in the TestPage.aspx.cs file i have :
namespace Foo.html
{
public partial class TestPage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
var t = 0;
}
[WebMethod]
public static string GetName()
{
var chk = new check
{
subject = "hello! ",
description = "13 Years Old"
};
return JsonConvert.SerializeObject(chk);
}
public class check
{
public string subject { get; set; }
public string description { get; set; }
}
}
}
I can debug the cs files like the "RouteConfig.cs" in the app.
but looks like i have a problem debugging the web forms part.
When i try to debug the app after setting breakpoints in the GetName and Page_Load methods the debugger never reaches them. the app running but l keep getting the ajax error that says:
error:undefined parsererror
im using the IIS express ( which comes with VS )
all debug are set in web.config :
<compilation debug="true" targetFramework="4.7.2" />
why i can't debug the app?
why it never reaches GetName method?
UPDATE
I changed the javascript error callback and now im getting the error:
unknown web method GetName
MasterPageFileattribute?