Russ Suter
asked on
How do I relay an HTTPWebResponse?
protected void Page_Load(object sender, EventArgs e)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://www.url.com/test");
string postData = this.Request.Form.ToString();
byte[] data = Encoding.UTF8.GetBytes(postData);
request.Method = "POST";
request.ContentType = this.Request.ContentType;
request.ContentLength = data.Length;
request.UserAgent = this.Request.UserAgent;
using (Stream stream = request.GetRequestStream())
{
stream.Write(data, 0, data.Length);
}
// ??? How do I do this...
// this.Response = request.GetResponse();
}
I'm just missing that last part. The code that is commented doesn't compile because I can't set this.Response to anything but that's essentially what I'm trying to do.
You cannot set the Response property. Set the Response's properties instead.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Found the solution elsewhere. Posting what I found here.