简体   繁体   中英

Post web request to xml file

I have a vendor that has supplied me with info I need to code in order to receive information from them. I need to send a POST request out to a URL ending in .xml. The documentation gives a JSON format and returns a response in XML. I'm a C# programmer and am not familiar with this yet. What type of request is this and how can I find an example on how to do it? I'm simply unsure of what to search for. If I run this code in JSON in the .aspx file, are there any security risks that the user will be able to see code by doing a view source?

Step 1: Use WebClient to download it.

string xml = "";
using (var client = new WebClient())
{
   xml  = client.DownLoadString("yourURL");   
}
// process the XML

I'm not sure what the JSON angle is, since the URI is ending in XML.
Inspect the string and see what you've got.

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