topical media & game development
mashup-amazon-08-08-01-SimpleHttpGet-Default.aspx.cs / cs
Author: Francis A. Shanahan
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Net;
using System.IO;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void cmdGo_Click(object sender, EventArgs e)
{
// Create a request using the URI specified in the form
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(this.txtUri.Text);
// Send the request and get a response object back
HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
// Obtain the ResponseStream from the Response object
Stream myResponseStream = myResponse.GetResponseStream();
// Create a reader for the response stream
StreamReader myReader = new StreamReader(myResponseStream);
// Read the stream from start to finish and display the results
this.myLiteral.Text = myReader.ReadToEnd();
}
}
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.