How to send and receive the POST request in asp.net?

你说的曾经没有我的故事 提交于 2019-12-13 05:29:02

问题


I have to send the XML data from aspx using POST method and receive the parameters in another Aspx file.

I have stored the XML data in xmlValidator named Javascript variable. I tried with the following code but it didn't work for me:

For sending I wrote: validator.aspx

<script type = "text/javascript">
    function submit_a() {
        $.post("../All.aspx", { "data": validatorXML }, function (result) {
         alert(result);
        });
 }
</script>

And at the receiving point i.e. in All.aspx page I wrote: (read from blog)

<%@ Page Language="C#" AutoEventWireup="true" %>
 <%
   NameValueCollection nvc = Request.Form;
     Response.Write(nvc["data"]); //Here i have to call a method written in a .cs file
  // which return some data and print in `validator.aspx`
%>

But it prints nothing. What is the problem?


回答1:


Read it.

http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.aspx



来源:https://stackoverflow.com/questions/12063023/how-to-send-and-receive-the-post-request-in-asp-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!