问题
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