Basically, I want to take a URLString and pull out all the variables and their values and send them to another page with a redirect to the taht page. How can I remove this without having the form and suppression of filing, etc ....
This is what I got.
string url = "http://www.blah.com/xyz.aspx";
StringBuilder postData = new StringBuilder();
postData.Append("CustomerID=" + HttpUtility.UrlEncode("Hello Rico") + "&");
postData.Append("FirstName=" + HttpUtility.UrlEncode("HelloFirstName"));
StreamWriter writer = null;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = postData.ToString().Length;
try
{
writer = new StreamWriter(request.GetRequestStream());
writer.Write(postData.ToString());
writer.Flush();
HttpWebResponse WebResp = (HttpWebResponse)request.GetResponse();
Stream Answer = WebResp.GetResponseStream();
StreamReader _Answer = new StreamReader(Answer);
Response.Write(_Answer.ReadToEnd());
}
finally
{
if (writer != null)
writer.Close();
}
source
share