how to send an xml file wrapped in a cookie to other website using httpwebrequest?
-
Hi, I need to send username,userid, and user email in an xml file. This xml file is wrapped in a cookie and what I need to do now is send this cookie using httpwebrequest to another website. My code is as follows:
Dim webBrowser As HttpWebRequest Dim sXmlData As XmlDocument Dim sCookie As HttpCookie sXmlData = New XmlDocument() 'writing data to an xml document With sXmlData .LoadXml(("" + Me.UserInfo.Username + "" + Convert.ToString(Me.UserId) + "" + Me.UserInfo.Email + "")) .Save("D:\\std.xml") End With 'reading the xmldocument into a cookie sCookie = New HttpCookie("UserInfoCookie") With sCookie .Values.Add("UserInfoCookie", sXmlData.InnerXml) End With 'sending the cookie using response but I want it through httpwebrequest ' Response.Cookies.Add(sCookie) ' Response.Redirect("http://www.abc.com") Try webBrowser = HttpWebRequest.Create("http://www.abc.com") With webBrowser .CookieContainer.Add(sCookie) **'this line is giving me an error** End With Catch ex As Exception End Try
thank you