使用AjaxMethod读取POST请求

本文关键字:请求 POST 读取 AjaxMethod 使用 | 更新日期: 2023-09-27 18:13:11

我需要在我的页面中读取POST请求。我使用。net 2.0,更高的版本是不可能的,我尝试用AjaxPro构建页面。当我在JS中发送请求到我的目的地时,我无法使用Request.Form, Page.Request或其他读取请求。这是我的代码


public class Ajax : System.Web.UI.Page{
    [AjaxMethod]
    public string getString(){
        //here i would like read POST request
        return "";
    }
}

使用AjaxMethod读取POST请求

您是否尝试从InputStream读取数据?其中一个问题有更多的细节。另外,您可以重置流,然后像下面这样读取内容

request.InputStream.Position = 0;
// read the data