[HttpPost]
public ActionResult Setmobile()
{
string text = "<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>"; 根据需要的数据拼xml数据
string postData = text;//System.Web.HttpUtility.UrlEncode(text, System.Text.Encoding.UTF8);
byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(postData);
HttpWebRequest objWebRequest = (HttpWebRequest)WebRequest.Create("url"); //发送地址 http://localhost:7118/Server/Default.aspx
objWebRequest.Method = "POST";//提交方式
objWebRequest.ContentType = "application/x-www-form-urlencoded";
objWebRequest.ContentLength = byteArray.Length;
Stream newStream = objWebRequest.GetRequestStream(); // Send the data.
newStream.Write(byteArray, 0, byteArray.Length); //写入参数
newStream.Close(); return Content("上传成功!") ; }