Forum Moderators: open
Uri strURL=new Uri("https://x-secure.overture.com/index.jhtml?_DARGS=/index.jhtml");
XmlDocument xdoc=new XmlDocument();
xdoc.Load("C:/Inetpub/wwwroot/xmlposthttp/acct.xml");
string dtcrequest=xdoc.InnerXml.ToString();
string dtcrequest1=HttpUtility.UrlEncode(dtcrequest);
string postdata="xml="+dtcrequest1+"&_D:/go2/xml/XMLRequestHandler.submit= ";
ASCIIEncoding encoding=new ASCIIEncoding();
byte [] postbuffer=encoding.GetBytes(postdata);
HttpWebRequest request=(HttpWebRequest)WebRequest.Create(strURL+postdata);
request.Headers.Add("ContentType","application/x-www-form-urlencoded");
request.Headers.Add("ContentLength",postbuffer.Length.ToString());
request.Method="POST";
request.Timeout=10000;
request.KeepAlive=true;
NetworkCredential mycred=new NetworkCredential("username","pwd");
CredentialCache mycache=new CredentialCache();
mycache.Add(strURL,"basic",mycred);
request.Credentials=mycache;
request.PreAuthenticate=true;
Stream reqstream=request.GetRequestStream();
bool write=reqstream.CanWrite;
reqstream.Write(postbuffer,0,postbuffer.Length);
reqstream.Close();
HttpWebResponse response=(HttpWebResponse)request.GetResponse();
Stream respstream=response.GetResponseStream();
StreamReader sr=new StreamReader(respstream);
string res=sr.ReadToEnd();
sr.Close();
TextBox1.Text=res;
this code is not returning any xml response.in fact it is returning the source code of [x-secure.overture.com...] web page.
If anybody has any clue about this please help me.