John Murry

John Murry

  • NA
  • 20
  • 0

string data from windows form application

Mar 23 2011 6:50 PM
Hello all,

I have a windows form application that I need to send a string to a web page. I have this code under the application:

public void PostDataToWebPage(string delimitedString)
{
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create("http://www.******.com/PostAccepter.aspx");
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
string postData = delimitedString;
request.ContentLength = postData.Length;
using (StreamWriter writer = new StreamWriter(request.GetRequestStream(), System.Text.Encoding.ASCII))
{
writer.Write(postData);
writer.Close();
}
}

But for the aspx.cs, I have no clue what to do? Could anyone let me know if I am on the right path and if not, to set me on the right path? Many thanks.

Answers (1)