简体   繁体   中英

Post XML Data to aspx page and reditect to the page from code behind

I need to post some xml data to a different aspx page and redirect to the same page. I tried the following code it does post to the page sucessfully but i need to redirect to the same page with posted data

         req.Method = "POST";       
        req.ContentType = "text/xml";     
        StreamWriter writer = new StreamWriter(req.GetRequestStream());
        writer.WriteLine(doc.InnerXml);
        writer.Close();
        rsp = req.GetResponse();

could you guys help me with this?

Thank in advance!!!

Response.Redirect should work:

rsp.Redirect(url);

What you're asking for is impossible in it's current form, this is due to the way HTTP works.

When you use POST you simply send data to the server, and collect the result. If you then want to show the user that page, you'll have to make a new request by the way of GET.

The easiest way to do this in asp.net is using Response.Redirect() .

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