简体   繁体   中英

AngularJS Post data to ASP.NET WebForms

I am attempting to post some simple data to a aspx page. I am new to AngularJS and was curious to know if this is possible. below is the .JS but I cannot seem to retrieve the data in the code behind. What is the syntax to retrieve post data within a web forms page?

   $scope.TestPost = function () {
        $http({
            url: "index.aspx",
            type: "POST",
            data: { test: 'Tom' },


        }).success(function (data) { alert(data) });

    };

here is my server side code. The request returns null

  protected void Page_Load(object sender, EventArgs e)
        {
          string s=  Request.Form["test"];
        }

Normally, you can retrieve it from the Form .

protected void Page_Load(object sender, EventArgs e)
{
    string test = Request.Form["test"];
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM