XML POST and parse in ASP.NET

前端 未结 1 1298
盖世英雄少女心
盖世英雄少女心 2021-01-19 13:40

If someone posts XML from an application to my ASP.NET page, how can I parse it and give the response back in XML format?

Sample client code posting XML to m

1条回答
  •  醉梦人生
    2021-01-19 13:44

    You could read the XML from the request stream. So inside your mypage.aspx:

    protected void Page_Load(object sender, EventAgrs e)
    {
        using (var reader = new StreamReader(Request.InputStream))
        {
            string xml = reader.ReadToEnd();
            // do something with the XML
        }
    }
    

    0 讨论(0)
提交回复
热议问题