01-02-2003, 06:27 PM
I'm putting a header which contains a shopping cart in my .aspx page. The
header-cart.html page is hosted on another server and has a java app running
which reads a cookie and dynamically updates the shopping cart information
in the header.
When I use IFrames to display the header the shopping cart info is captured
and displayed in my .aspx page. However, when I create a webrequest object
to go and grab the HTML page and stream it into my .aspx page the shopping
cart info is Not there.
I realize that the latter method does not initialize the java app which updates
the html, but how does the Iframe manage this?
Further more, can I mimic this with HTTPWebRequest?
My code:
WebRequest req = WebRequest.Create("http://www.nokiausa.com/header-cart.html?mode=s&hosted=1&tpv=brierley");
result = req.GetResponse();
Stream ReceiveStream = result.GetResponseStream();
Encoding encode = System.Text.Encoding.GetEncoding("utf-8");
StreamReader sr = new StreamReader( ReceiveStream, encode
);
//Console.WriteLine("\r\nResponse stream received");
Char[] read = new Char[256];
int count = sr.Read( read, 0, 256 );
//Console.WriteLine("HTML...\r\n");
while (count > 0)
{
String str = new String(read, 0, count);
Response.Write(str);
count = sr.Read(read, 0, 256);
}
header-cart.html page is hosted on another server and has a java app running
which reads a cookie and dynamically updates the shopping cart information
in the header.
When I use IFrames to display the header the shopping cart info is captured
and displayed in my .aspx page. However, when I create a webrequest object
to go and grab the HTML page and stream it into my .aspx page the shopping
cart info is Not there.
I realize that the latter method does not initialize the java app which updates
the html, but how does the Iframe manage this?
Further more, can I mimic this with HTTPWebRequest?
My code:
WebRequest req = WebRequest.Create("http://www.nokiausa.com/header-cart.html?mode=s&hosted=1&tpv=brierley");
result = req.GetResponse();
Stream ReceiveStream = result.GetResponseStream();
Encoding encode = System.Text.Encoding.GetEncoding("utf-8");
StreamReader sr = new StreamReader( ReceiveStream, encode
);
//Console.WriteLine("\r\nResponse stream received");
Char[] read = new Char[256];
int count = sr.Read( read, 0, 256 );
//Console.WriteLine("HTML...\r\n");
while (count > 0)
{
String str = new String(read, 0, count);
Response.Write(str);
count = sr.Read(read, 0, 256);
}