By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,463 Members | 1,528 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,463 IT Pros & Developers. It's quick & easy.

Width property is lost when using the GetResponseStream() function

P: n/a
I'm using the next code to get the source code from a web page and save it to
disk, all works fine except that the width property is lost:

wrRequest = (HttpWebRequest)HttpWebRequest.Create("www.server. com/page.aspx");
wrResponse = (HttpWebResponse)wrRequest.GetResponse();
srReader = new StreamReader(wrResponse.GetResponseStream());
sHTML = srReader.ReadToEnd();

why this error if when I see the web page from the server it works ok?

in the source code from IE directly from the page of the web server, the
input tag is as follow:

<input name="NAME" type="text" value="VALUE" id="IDNAME" disabled="disabled"
style="width:368px;" />

but in the source code from the page saved in local disk the input tag is:

<input name="NAME" type="text" value="VALUE" id="IDNAME" disabled="disabled"
/>

the style="width:368px;" property doesn't apear, any help?
Nov 16 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a

"Andres Romero" <An**********@discussions.microsoft.com> wrote in message
news:F6**********************************@microsof t.com...
I'm using the next code to get the source code from a web page and save it
to
disk, all works fine except that the width property is lost:

wrRequest =
(HttpWebRequest)HttpWebRequest.Create("www.server. com/page.aspx");
wrResponse = (HttpWebResponse)wrRequest.GetResponse();
srReader = new StreamReader(wrResponse.GetResponseStream());
sHTML = srReader.ReadToEnd();

why this error if when I see the web page from the server it works ok?

in the source code from IE directly from the page of the web server, the
input tag is as follow:

<input name="NAME" type="text" value="VALUE" id="IDNAME"
disabled="disabled"
style="width:368px;" />

but in the source code from the page saved in local disk the input tag is:

<input name="NAME" type="text" value="VALUE" id="IDNAME"
disabled="disabled"
/>

the style="width:368px;" property doesn't apear, any help?


The web server is probably sniffing your "browser" and sending you downlevel
HTML.

Try adding

request.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1;
..NET CLR 1.1.4322)"

David
Nov 16 '05 #2

P: n/a


"David Browne" wrote:

"Andres Romero" <An**********@discussions.microsoft.com> wrote in message
news:F6**********************************@microsof t.com...
I'm using the next code to get the source code from a web page and save it
to
disk, all works fine except that the width property is lost:

wrRequest =
(HttpWebRequest)HttpWebRequest.Create("www.server. com/page.aspx");
wrResponse = (HttpWebResponse)wrRequest.GetResponse();
srReader = new StreamReader(wrResponse.GetResponseStream());
sHTML = srReader.ReadToEnd();

why this error if when I see the web page from the server it works ok?

in the source code from IE directly from the page of the web server, the
input tag is as follow:

<input name="NAME" type="text" value="VALUE" id="IDNAME"
disabled="disabled"
style="width:368px;" />

but in the source code from the page saved in local disk the input tag is:

<input name="NAME" type="text" value="VALUE" id="IDNAME"
disabled="disabled"
/>

the style="width:368px;" property doesn't apear, any help?


The web server is probably sniffing your "browser" and sending you downlevel
HTML.

Try adding

request.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1;
..NET CLR 1.1.4322)"

David

Nov 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.