asked on
2016-04-07 15:26:47 192.168.25.150 POST /JAInBoundWebService/ReceiveRRDxml.asmx/ReceiveXmlFromRRD - 81 - 192.168.25.150 - - 500 0 0 121
<system.webServer>
<httpErrors errorMode="Detailed" />
</system.webServer>
<system.web>
<compilation debug="true" targetFramework="4.5.1"/>
<customErrors mode="Off" />
<authentication mode="Windows"/>
<httpRuntime executionTimeout="1200" maxRequestLength="16384"/>
<webServices>
<protocols>
<add name="HttpPost"/>
</protocols>
</webServices>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
</system.web>
public static string CreateHttpPostRequest(string postData)
{
try
{
ASCIIEncoding encoding = new ASCIIEncoding();
byte[] byte1 = encoding.GetBytes(postData);
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Properties.Settings.Default.TestURL);
request.Timeout = System.Convert.ToInt32(10000);
request.Credentials = new NetworkCredential(Properties.Settings.Default.Username, Properties.Settings.Default.Password);
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
//request.ContentType = "text/xml";
request.ContentLength = byte1.Length;
Stream myStream = request.GetRequestStream();
myStream.Write(byte1, 0, byte1.Length);
myStream.Close();
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
System.IO.Stream stream = response.GetResponseStream();
System.Text.Encoding ec = System.Text.Encoding.GetEncoding("utf-8");
System.IO.StreamReader reader = new System.IO.StreamReader(stream, ec);
string str2 = reader.ReadToEnd();
response.Close();
stream.Close();
reader.Close();
return str2;
}
catch (Exception ex)
{
return ex.Message;
}
}
public static string SimplePost(string postData)
{
try
{
var wb = new WebClient();
var data = new NameValueCollection();
data["xmlDoc"] = postData;
var response = wb.UploadValues(Properties.Settings.Default.TestURL, "POST", data);
return Encoding.ASCII.GetString(response);
}
catch (Exception ex)
{
return ex.Message;
}
}