Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Controls / August 2007

Tip: Looking for answers? Try searching our database.

Setting WebBrowser.DocumentText - interprets as plaintext?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dylan Nicholson - 23 Aug 2007 05:33 GMT
Hello,

I have an odd problem that only occurs on one machine, running IE 6.0
(latest SP etc.) and Windows Server 2000, .NET 2.0 SP1, whereby
setting the DocumentText property sometimes causes the text to be
interpreted as plain text rather than HTML.  That is, after doing:

WebBrowser.DocumentText = new string(' ', 192) + "<html><body>Test</
body></html>"

then checking WebBrowser.DocumentText again, it's now

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=utf-8"></
HEAD>
<BODY><PRE>

&lt;html&gt;&lt;body&gt;Test&lt;/body
&gt;&lt;/html&gt;</PRE></BODY></HTML>

If the initial space padding is only 191 characters, it behaves fine!

There's other cases without this padding where the problem still
occurs, but that's the simplest to explain.  I've tried upgrading
everything I can on the problem machine, but it appears to have the
latest of everything, granted that it's an old 2000 server machine.

Anyone seen anything like this before?

Dylan
Igor Tandetnik - 23 Aug 2007 13:00 GMT
> I have an odd problem that only occurs on one machine, running IE 6.0
> (latest SP etc.) and Windows Server 2000, .NET 2.0 SP1, whereby
[quoted text clipped - 5 lines]
>
> If the initial space padding is only 191 characters, it behaves fine!

I believe IE performs content sniffing to figure out what kind of text
it is given. The sniffing is very simple - it just looks for <html> tag
in the first few characters of the text. I've seen this problem with
regular standalone IE, when a) a page has, say, a large comment at the
top before <html> tag, and b) the server sends an incorrect Content-Type
header, usually text/plain.
Signature

With best wishes,
   Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925

Dylan Nicholson - 24 Aug 2007 00:33 GMT
> > I have an odd problem that only occurs on one machine, running IE 6.0
> > (latest SP etc.) and Windows Server 2000, .NET 2.0 SP1, whereby
[quoted text clipped - 12 lines]
> top before <html> tag, and b) the server sends an incorrect Content-Type
> header, usually text/plain.

Yes, I figured that's what it was doing...just don't get why it only
occurs on the 2000 server machine.
That machine has I.E. 6.0.2800 and it appears there's no way of
upgrading to it 6.0.2900, which is what my XP machine has, where it
works fine.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.