C
Chris Crabtree
ok,
So I ran into this problem today with HttpWebRequest and a website
using framesets. I get the response "This page uses frames, but your
browser does not support them."
The only post I can find on the web regarding this issue suggest
setting the UserAgent property to a recognizable browser, so I traced
IE 6 and added the same UserAgent string that it uses. No avail. I
imagine that there must be something wrong with the way I'm doing
this. It appears to be happening with any website I try that uses
frames. Since there is so little mentioned of this problem on the
net, it must be me, I highly doubt I've discovered some big problem.
I've created a very small console app to duplicate the problem. The
code is found below: Please try it yourself and tell me if you can
discover any means to overcome this issue.
Thanks,
Chris
------------------
using System;
using System.IO;
using System.Net;
namespace TestFramesWebRequest
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
Uri uri = new Uri("http://longhorn.msdn.microsoft.com");
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(uri);
req.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;
..NET CLR 1.1.4322)";
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
Stream s = resp.GetResponseStream();
StreamReader srReadToEnd = new StreamReader(
resp.GetResponseStream() );
Console.WriteLine(srReadToEnd.ReadToEnd());
srReadToEnd.Close();
Console.ReadLine();
}
}
}
So I ran into this problem today with HttpWebRequest and a website
using framesets. I get the response "This page uses frames, but your
browser does not support them."
The only post I can find on the web regarding this issue suggest
setting the UserAgent property to a recognizable browser, so I traced
IE 6 and added the same UserAgent string that it uses. No avail. I
imagine that there must be something wrong with the way I'm doing
this. It appears to be happening with any website I try that uses
frames. Since there is so little mentioned of this problem on the
net, it must be me, I highly doubt I've discovered some big problem.
I've created a very small console app to duplicate the problem. The
code is found below: Please try it yourself and tell me if you can
discover any means to overcome this issue.
Thanks,
Chris
------------------
using System;
using System.IO;
using System.Net;
namespace TestFramesWebRequest
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
Uri uri = new Uri("http://longhorn.msdn.microsoft.com");
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(uri);
req.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;
..NET CLR 1.1.4322)";
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
Stream s = resp.GetResponseStream();
StreamReader srReadToEnd = new StreamReader(
resp.GetResponseStream() );
Console.WriteLine(srReadToEnd.ReadToEnd());
srReadToEnd.Close();
Console.ReadLine();
}
}
}