Monday, May 10, 2010

Use the rest Webservice

using System.Text;
using System.Net;
using System.IO;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void btnSend_Click(object sender, EventArgs e)
{
string parameter="a/b";
Uri address = new Uri("website Address" + parameter);
HttpWebRequest request = WebRequest.Create(address) as HttpWebRequest;

request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
{
StreamReader reader = new StreamReader(response.GetResponseStream());
//Response.Write(reader.ReadLine());
lblMessage.Text = reader.ReadLine();
lblMessage.Visible = true;
}
}
}

No comments:

Post a Comment