简体   繁体   English

AngularJS将数据发布到ASP.NET WebForms

[英]AngularJS Post data to ASP.NET WebForms

I am attempting to post some simple data to a aspx page. 我正在尝试将一些简单数据发布到aspx页面。 I am new to AngularJS and was curious to know if this is possible. 我是AngularJS的新手,很想知道这是否可行。 below is the .JS but I cannot seem to retrieve the data in the code behind. 下面是.JS,但我似乎无法在后面的代码中检索数据。 What is the syntax to retrieve post data within a web forms page? 在Web表单页面中检索帖子数据的语法是什么?

   $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 请求返回null

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

Normally, you can retrieve it from the Form . 通常,您可以从Form检索它。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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