Home » Windows OS

Script error invalid character using the WebBrowser control

One of our applications was broken after installing IE7. We narrowed the problem down to the below:

WebBrowser browser = new WebBrowser();
browser.DocumentText = "<script src=\"file://c:\test\foo.js\"></script><p>test</p>";

This code works fine under IE6, but when running on IE7 you get the error:
Line: 2
Error: Invalid Character
Code: 0
URL: about:blank

It doesn't matter what is in the foo.js file, it can be completely blank and you will get the error. If you replace the file://c:\test\foo.js with a valid http URL (Internet zone), it works fine. If you create a file with the contents and load it into the control using browser.Navigate() it also loads fine. So it seems related to security.

Any ideas? This repros 100% on WinXP SP2 with IE7 Final.



21 Answers Found


Answer 1

but what about getting the same error  message here:

http://safety.live.com/site/en-US/scanner/default_scan.htm ?

i hope now we'll get faster an answer


Answer 2

There are some new information disclosure fixes in IE 7 that disallow arbitrary usage of the file  system for loading of scripts. There are several fixes available to get you up and running. First, don't use an internet  zone page for the content, instead load  a dummy HTML page from disk to put the browser control  into the local machine zone. Then you can load from the local machine zone  just fine.

The second is to show intent that you don't mind allowing web-sites arbitrary access to scripts on your local machine by setting a feature control key. Some applications  don't load internet content and so aren't vulnerable and so the usage of the key is a valid  fix:

HKLM\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BLOCK_LMZ_SCRIPT (registry key)

MyAppName.exe:DWORD(0x0) (registry value)

Hopefully one of these options is suitable for your scenario. We warn against setting the feature control key for your application unless you are sure that internet content is not going to be loaded by your application.


Answer 3

Justin -- thanks  for the suggestion.

We tried the following:

WebBrowser browser  = new WebBrowser();
browser.Navigate(@"c:\test\blank.html");     // suggestion 1: try put the browser in local machine mode
browser.DocumentText = "<script src=\"file://c:\test\foo.js\"></script><p>test</p>";     // still yields same script  error

We also added some code  to make sure the navigate  was complete before setting the DocumentText for good measure but that did not make a difference, we get the same script error.

It looks like when you do a document.write() it blows away the context altogether. As a host of the control, I would think there would be a programmatic way to control  the zone  security policy. Changing the registry is not really a good option since we also show some real web pages.

This seems like a very common scenario for MSHTML -- generate some dynamic content in memory which references scripts. I'm surprised this doesn't break applications  like Money, etc. We really would like to avoid writing to a temporary file  each time, although that does solve the problem.




Answer 4

The document write may indeed blow away your context. But gaining access to the elements inside the body of the current document would not. Once you navigate, you can try to inject HTML into the document by getting the body element and doing an innerHTML call on that.

browser.Document.Body.InnerHtml seems to be the .NET syntax you'd want.

Is this a common scenario? Well, yes and no. By adopting about:blank, you automatically get placed into the Internet zone  in most cases (there are some exceptions). Controls want this to occur because they get more protection from the web in this mode which is why the .NET WebBrowser control  behaves the way it does. Secure by default is our end goal in almost all cases.

Note, if you don't care about the dynamic scenario, you can always write to disk as well. I always put this out there just in case the application at hand warrants the approach. If you truly want dynamic page generation though, I think doing what you've done above, grabbing the body and injecting content will solve your problem.


Answer 5


I am not sure whether this is relevant.

But I faced exactly the same problem  you had described, and my problem was fixed after I added the about:blank to the trusted sites in IE7. Well this is not the best of the solutions but it solves the problem. I am working on devising an alternative solution for this.  Thanks,

Answer 6

It works  for me too, Prabs, thanks  a lot! But the problem  now is I get all the time a security  warning asking me if I allow the current Web page to open a site in my Trusted sites list which is, of course, about:blank

Answer 7

Since going to IE-7 I encounter this message when I open some but not all of the logs in my Norton Internet Security suite.  The problem  with allowing all communication with URL about:blank is that about:blank is an infamous purveyor of malware.  They are notorious especially but far from exclusively for homepage hijack exploits.  They have numerous publications that include downloaders, Trojans, web trackers, etc.  Questions: Why are we seeing this message? How is it related  to adopting IE-7? How do we fix it without allowing bad guys free access? I can tell you that Norton Antivirus does not detect a problem, nor do eTrust Pest Patrol, Ad-aware, or SpySweeper.

Answer 8

One way I fixed that error  - about:blank 1.right click on the desktop - select properties 2. chose the desktop tab 3. click on the button customise desktop 4 select the web tab 5. click on the properties button 6. stay under the default settings - 7. web documents tab -then uncheck make this page available offline apply and ok 8. Then close out of all windows you have open You will find that you are having no more problems with this any more . PS. Hope this helps everyone thats still having problem!

Answer 9

Sorry, not in my case

Answer 10

I did a clean reinstall of everything and now is working Twilight Zone...

Answer 11

I am still faced with the problem  that I can not use the Windows Live OneCare safety scanner.  How did you add the about:blank to the trusted sites in IE7?

Answer 12


Getting the same error  but in a slightly different manner, it is happening for me when I try to set the browser  URL to that of an Authorware .AAM file:


It works  fine if I use IE7 with "myserver" in the list of IE's trusted sites but doesn't work in an application using the WebBrowser control.

The registry modifications suggested by Justin Rodgers does work, but is an unacceptable solution to my situation as the application with the WebBrowser control  is already deployed to thousands of machines.

I'm really trying to find a solution that can be implemented on the server side.



Answer 13

Control Panel => Internet Options => Security tab => select "Trusted sites" => click on "Sites" button => Trusted sites window => "Add this website to the zone:" - write "about:blank" => click on "Add" button => click on "Close" button => click "OK" in Internet Properties window.

But, like I said, after a clean installation of Windows, I uninstalled IE6 from "Add/Remove Windows Components" and I installed IE7 and everything worked fine, I did not need this "solution" anymore.


Answer 14

Control Panel => Internet Options => Security tab => select "Trusted sites" => click on "Sites" button => Trusted sites window => "Add this website to the zone:" - write "about:blank" => click on "Add" button => click on "Close" button => click "OK" in Internet Properties window.

But, like I said, after a clean installation of Windows, I uninstalled IE6 from "Add/Remove Windows Components" and I installed IE7 and everything worked fine, I did not need this "solution" anymore, neither making My Home Page unavailable offline.


Answer 15

After digging for two days, I think I found the reason. When your code  calls write(), IE implicitly opens a new document (calls open() implicitly), even when open() is called just before. For script  object of IE, it can initialize the URL of the new document with the file  it resides. But for COM call, no context exists, then IE will still initialize the new doc with "about:blank". So, write() operation will create  a doc in "about:blank" instead of in the page before write() is called. Together with the LMZ_SCRIPT restriction, loading external JS file will fail.

One solution is the registry change mentioned by Justin previously, by allowing LMZ_SCRIPT for certain applications.

I also found a registryless workaround. You can use a dummy HTML file with a helper javascript function in it, and navigate  to this file first. When your application wants to write HTML containing script, call document.write() through the helper JS function. Then the call is made under correct context. This is a reasonable trick that we are making use of the context of <script>.

<script language="javascript">
function WriteHelper(str)
In C++ Code:
// Get IHTMLWindow2 from IHTMLDocument2, say, pWin
// Use pWin->GetIDsOfNames() to get "WriteHelper" method of pWin
// Use pWin->Invoke() to invoke the javascript function, providing the string as parameter

I tried this way to write "<script src='jscript1.js'></script>" and it works, as long as JS file is in the same domain of the helper HTML. By this way you don't have to change the registry.


Answer 16

Thanks for this tip (I wouldn't have thought of that !)

Next problem  is calling IDispatch::Invoke() from C# (most development is .NET nowdays).

I got as far as getting an IDispatch from IHTMLWindow2, courtesy of interop but GetIDsOfNames() keeps failing .

Do you know of some working C# (or VB.NET) code  for calling IDispatch ?

Answer 17

Well, never could get GetIDsOfNames() to return anything useful so I tried a more mundane trick, generating a temporary HTML (I initially wanted to avoid relying on the filesystem) file  and loading it : it worked.

The temp file contains the needed <script> elements, this time, and I get no complains about "uncorrect character  line 1", everything hunky dory.

Hope it helps someone :)

Answer 18

Had the exact same problem.  The solution I went with was to load  a blank  html file on startup, and do all further updates by modifying the page using the DOM, rather than replacing it via DocumentText.  That included creating the link to the external javascript file  using the DOM, as shown below: HtmlElement newElement = webBrowser1.Document.CreateElement("script"); newElement.SetAttribute("type", "text/javascript"); newElement.SetAttribute("src", "file://C:/junk/junk.js"); HtmlElement head = webBrowser1.Document.GetElementsByTagName("head")[0]; head.AppendChild(newElement);

Answer 19

While activating action key to scan on Window Live one care the following error  appeared:-

Internet Explorer script  error

An error occured the script on this page

Line: 90
Error: Obect expected
Code: 0
URL: about:blank

And then it asks do you want to continue ??

On each action Yes or No there is no function

Appriciate if any cure for this is send to me on my mail id : wideworldevent@gmail.com


Answer 20

Thank u so much. I've had this issue since Christmas when my hubby got his new mp3 player and has been downloading songs. Your solution so helped.


Answer 21

thank you, Berriman! that helped! i'm not getting any messages anymore!

hi i am facing problem while running the following sql statement

SETNOCOUNTONDECLARE @hDoc INTEXEC sp_xml_preparedocument @hDoc OUTPUT, '<NewDataSet> <Forms Layout=''&lt;StackPanel Background=&quot;#FFFFFFFF&quot; Name=&quot;StackPanelUser&quot; Width=&quot;1001&quot; Height=&quot;600&quot; Margin=&quot;10,5,10,5&quot; HorizontalAlignment=&quot;Center&quot; ClipToBounds=&quot;True&quot; twcdd:RadDragAndDropManager.AllowDrop=&quot;True&quot; xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot; xmlns:iedf=&quot;clr-namespace:Iris.Ews.Designer.Form;assembly=Iris.Ews.Designer.Form&quot; xmlns:twcdd=&quot;clr-namespace:Telerik.Windows.Controls.DragDrop;assembly=Telerik.Windows.Controls&quot;&gt;&#xD;&#xA; &lt;ScrollViewer HorizontalScrollBarVisibility=&quot;Auto&quot; VerticalScrollBarVisibility=&quot;Auto&quot; Name=&quot;scrollbar&quot; Width=&quot;1001&quot; Height=&quot;600&quot;&gt;&#xD;&#xA; &lt;Canvas Background=&quot;#FFFFFFFF&quot; Name=&quot;CanvasPanelUser&quot; Tag=&quot;sampleform&quot; Width=&quot;1001&quot; Height=&quot;600&quot; iedf:ExtProperties.ParentEntity=&quot;&quot; iedf:FormProperties.CanvasHeight=&quot;600&quot; iedf:FormProperties.ScreenName=&quot;sampleform&quot;&gt;&#xD;&#xA;  &lt;InkCanvas EditingMode=&quot;None&quot; MoveEnabled=&quot;True&quot; ResizeEnabled=&quot;True&quot; Name=&quot;inkCanvas&quot; Width=&quot;1001&quot; Height=&quot;600&quot; Canvas.Left=&quot;0&quot; Canvas.Top=&quot;0&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;25&quot; Y1=&quot;0&quot; X2=&quot;25&quot; Y2=&quot;600&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;50&quot; Y1=&quot;0&quot; X2=&quot;50&quot; Y2=&quot;600&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;75&quot; Y1=&quot;0&quot; X2=&quot;75&quot; Y2=&quot;600&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;100&quot; Y1=&quot;0&quot; X2=&quot;100&quot; Y2=&quot;600&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;125&quot; Y1=&quot;0&quot; X2=&quot;125&quot; Y2=&quot;600&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;150&quot; Y1=&quot;0&quot; X2=&quot;150&quot; Y2=&quot;600&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;175&quot; Y1=&quot;0&quot; X2=&quot;175&quot; Y2=&quot;600&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;200&quot; Y1=&quot;0&quot; X2=&quot;200&quot; Y2=&quot;600&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;225&quot; Y1=&quot;0&quot; X2=&quot;225&quot; Y2=&quot;600&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;250&quot; Y1=&quot;0&quot; X2=&quot;250&quot; Y2=&quot;600&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;275&quot; Y1=&quot;0&quot; X2=&quot;275&quot; Y2=&quot;600&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;300&quot; Y1=&quot;0&quot; X2=&quot;300&quot; Y2=&quot;600&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;325&quot; Y1=&quot;0&quot; X2=&quot;325&quot; Y2=&quot;600&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;350&quot; Y1=&quot;0&quot; X2=&quot;350&quot; Y2=&quot;600&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;375&quot; Y1=&quot;0&quot; X2=&quot;375&quot; Y2=&quot;600&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;400&quot; Y1=&quot;0&quot; X2=&quot;400&quot; Y2=&quot;600&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;425&quot; Y1=&quot;0&quot; X2=&quot;425&quot; Y2=&quot;600&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;450&quot; Y1=&quot;0&quot; X2=&quot;450&quot; Y2=&quot;600&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;475&quot; Y1=&quot;0&quot; X2=&quot;475&quot; Y2=&quot;600&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;500&quot; Y1=&quot;0&quot; X2=&quot;500&quot; Y2=&quot;600&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;525&quot; Y1=&quot;0&quot; X2=&quot;525&quot; Y2=&quot;600&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;550&quot; Y1=&quot;0&quot; X2=&quot;550&quot; Y2=&quot;600&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;575&quot; Y1=&quot;0&quot; X2=&quot;575&quot; Y2=&quot;600&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;600&quot; Y1=&quot;0&quot; X2=&quot;600&quot; Y2=&quot;600&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;625&quot; Y1=&quot;0&quot; X2=&quot;625&quot; Y2=&quot;600&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;650&quot; Y1=&quot;0&quot; X2=&quot;650&quot; Y2=&quot;600&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;675&quot; Y1=&quot;0&quot; X2=&quot;675&quot; Y2=&quot;600&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;700&quot; Y1=&quot;0&quot; X2=&quot;700&quot; Y2=&quot;600&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;725&quot; Y1=&quot;0&quot; X2=&quot;725&quot; Y2=&quot;600&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;750&quot; Y1=&quot;0&quot; X2=&quot;750&quot; Y2=&quot;600&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;775&quot; Y1=&quot;0&quot; X2=&quot;775&quot; Y2=&quot;600&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;800&quot; Y1=&quot;0&quot; X2=&quot;800&quot; Y2=&quot;600&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;825&quot; Y1=&quot;0&quot; X2=&quot;825&quot; Y2=&quot;600&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;850&quot; Y1=&quot;0&quot; X2=&quot;850&quot; Y2=&quot;600&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;875&quot; Y1=&quot;0&quot; X2=&quot;875&quot; Y2=&quot;600&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;900&quot; Y1=&quot;0&quot; X2=&quot;900&quot; Y2=&quot;600&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;925&quot; Y1=&quot;0&quot; X2=&quot;925&quot; Y2=&quot;600&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;950&quot; Y1=&quot;0&quot; X2=&quot;950&quot; Y2=&quot;600&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;975&quot; Y1=&quot;0&quot; X2=&quot;975&quot; Y2=&quot;600&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;1000&quot; Y1=&quot;0&quot; X2=&quot;1000&quot; Y2=&quot;600&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;0&quot; Y1=&quot;25&quot; X2=&quot;1001&quot; Y2=&quot;25&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;0&quot; Y1=&quot;50&quot; X2=&quot;1001&quot; Y2=&quot;50&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;0&quot; Y1=&quot;75&quot; X2=&quot;1001&quot; Y2=&quot;75&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;0&quot; Y1=&quot;100&quot; X2=&quot;1001&quot; Y2=&quot;100&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;0&quot; Y1=&quot;125&quot; X2=&quot;1001&quot; Y2=&quot;125&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;0&quot; Y1=&quot;150&quot; X2=&quot;1001&quot; Y2=&quot;150&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;0&quot; Y1=&quot;175&quot; X2=&quot;1001&quot; Y2=&quot;175&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;0&quot; Y1=&quot;200&quot; X2=&quot;1001&quot; Y2=&quot;200&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;0&quot; Y1=&quot;225&quot; X2=&quot;1001&quot; Y2=&quot;225&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;0&quot; Y1=&quot;250&quot; X2=&quot;1001&quot; Y2=&quot;250&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;0&quot; Y1=&quot;275&quot; X2=&quot;1001&quot; Y2=&quot;275&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;0&quot; Y1=&quot;300&quot; X2=&quot;1001&quot; Y2=&quot;300&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;0&quot; Y1=&quot;325&quot; X2=&quot;1001&quot; Y2=&quot;325&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;0&quot; Y1=&quot;350&quot; X2=&quot;1001&quot; Y2=&quot;350&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;0&quot; Y1=&quot;375&quot; X2=&quot;1001&quot; Y2=&quot;375&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;0&quot; Y1=&quot;400&quot; X2=&quot;1001&quot; Y2=&quot;400&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;0&quot; Y1=&quot;425&quot; X2=&quot;1001&quot; Y2=&quot;425&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;0&quot; Y1=&quot;450&quot; X2=&quot;1001&quot; Y2=&quot;450&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;0&quot; Y1=&quot;475&quot; X2=&quot;1001&quot; Y2=&quot;475&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;0&quot; Y1=&quot;500&quot; X2=&quot;1001&quot; Y2=&quot;500&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;0&quot; Y1=&quot;525&quot; X2=&quot;1001&quot; Y2=&quot;525&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;0&quot; Y1=&quot;550&quot; X2=&quot;1001&quot; Y2=&quot;550&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA;  &lt;Line X1=&quot;0&quot; Y1=&quot;575&quot; X2=&quot;1001&quot; Y2=&quot;575&quot; Stroke=&quot;#400000FF&quot; StrokeThickness=&quot;0.1&quot; IsHitTestVisible=&quot;False&quot; /&gt;&#xD;&#xA; &lt;/Canvas&gt;&#xD;&#xA; &lt;/ScrollViewer&gt;&#xD;&#xA;&lt;/StackPanel&gt;'' Binding='''' Version=''0'' Id=''0f57b65c-10c9-4ace-ab1f-9aa8d7323a73'' /> <DocumentTemplates> <Id>99134770-1883-4d35-87f3-541e39963c95</Id> <TemplateData>&lt;FlowDocument PagePadding=''5,0,5,0'' AllowDrop=''True'' NumberSubstitution.CultureSource=''User'' xmlns=''http://schemas.microsoft.com/winfx/2006/xaml/presentation''&gt;&lt;Table CellSpacing=''0'' Margin=''0,0,0,0''&gt;&lt;Table.Columns&gt;&lt;TableColumn Width=''134.73'' /&gt;&lt;TableColumn Width=''441.27'' /&gt;&lt;/Table.Columns&gt;&lt;TableRowGroup&gt;&lt;TableRow&gt;&lt;TableCell RowSpan=''2'' Padding=''7.2,0,7.2,0'' BorderThickness=''1.33,1.33,1.33,0'' BorderBrush=''#FF000000''&gt;&lt;Paragraph Margin=''0,0,0,0'' TextAlignment=''Right'' FontFamily=''Arial'' FontWeight=''Bold'' FontSize=''13.3333333333333''&gt;&lt;Span &gt;Document Name&lt;/Span&gt;&lt;/Paragraph&gt;&lt;/TableCell&gt;&lt;TableCell Padding=''7.2,0,7.2,0'' BorderThickness=''1.33,1.33,1.33,1.33'' BorderBrush=''#FF000000''&gt;&lt;Paragraph Margin=''0,0,0,0'' TextAlignment=''Left'' FontFamily=''Arial'' FontWeight=''Bold'' FontSize=''16''&gt;&lt;Span &gt;System Requirements Specification (SRS)&lt;/Span&gt;&lt;/Paragraph&gt;&lt;/TableCell&gt;&lt;/TableRow&gt;&lt;TableRow&gt;&lt;TableCell Padding=''7.2,0,7.2,0'' BorderThickness=''1.33,1.33,1.33,1.33'' BorderBrush=''#FF000000''&gt;&lt;Paragraph Margin=''0,0,0,0'' TextAlignment=''Left'' FontFamily=''Arial'' FontWeight=''Bold'' FontSize=''16''&gt;&lt;Span Foreground=''#FF0000FF'' xml:space=''preserve''&gt;IRIS &lt;/Span&gt;&lt;Span &gt;–&lt;/Span&gt;&lt;Span Foreground=''#FF0000FF'' &gt; IRIS_WORKFLOW_SOLUTION&lt;/Span&gt;&lt;/Paragraph&gt;&lt;Paragraph Margin=''0,0,0,0'' TextAlignment=''Left'' FontFamily=''Arial'' FontWeight=''Bold'' FontSize=''16''&gt;&lt;Span Foreground=''#FF0000FF'' xml:space=''preserve''&gt;Packaging and deployment &lt;/Span&gt;&lt;/Paragraph&gt;&lt;/TableCell&gt;&lt;/TableRow&gt;&lt;TableRow&gt;&lt;TableCell Padding=''7.2,0,7.2,0'' BorderThickness=''1.33,1.33,1.33,1.33'' BorderBrush=''#FF000000''&gt;&lt;Paragraph Margin=''0,0,0,0'' TextAlignment=''Right'' FontFamily=''Arial'' FontWeight=''Bold'' FontSize=''13.3333333333333''&gt;&lt;Span &gt;Version No.&lt;/Span&gt;&lt;/Paragraph&gt;&lt;/TableCell&gt;&lt;TableCell Padding=''7.2,0,7.2,0'' BorderThickness=''1.33,1.33,1.33,1.33'' BorderBrush=''#FF000000''&gt;&lt;Paragraph Margin=''0,0,0,0'' TextAlignment=''Left'' FontFamily=''Arial'' FontStyle=''Italic'' FontSize=''16''&gt;&lt;Span FontStyle=''Normal'' FontWeight=''Bold'' &gt;0.1&lt;/Span&gt;&lt;/Paragraph&gt;&lt;/TableCell&gt;&lt;/TableRow&gt;&lt;TableRow&gt;&lt;TableCell Padding=''7.2,0,7.2,0'' BorderThickness=''1.33,1.33,1.33,1.33'' BorderBrush=''#FF000000''&gt;&lt;Paragraph Margin=''0,0,0,0'' TextAlignment=''Right'' FontFamily=''Arial'' FontWeight=''Bold'' FontSize=''13.3333333333333''&gt;&lt;Span &gt;Release Date&lt;/Span&gt;&lt;/Paragraph&gt;&lt;/TableCell&gt;&lt;TableCell Padding=''7.2,0,7.2,0'' BorderThickness=''1.33,1.33,1.33,1.33'' BorderBrush=''#FF000000''&gt;&lt;Paragraph Margin=''0,0,0,0'' TextAlignment=''Left'' FontFamily=''Arial'' FontWeight=''Bold'' FontSize=''16''&gt;&lt;Span &gt;31-MAR-2010&lt;/Span&gt;&lt;/Paragraph&gt;&lt;/TableCell&gt;&lt;/TableRow&gt;&lt;TableRow&gt;&lt;TableCell Padding=''7.2,0,7.2,0'' BorderThickness=''1.33,1.33,1.33,1.33'' BorderBrush=''#FF000000''&gt;&lt;Paragraph Margin=''0,0,0,0'' TextAlignment=''Right'' FontFamily=''Arial'' FontWeight=''Bold'' FontSize=''13.3333333333333''&gt;&lt;Span &gt;Document ID&lt;/Span&gt;&lt;/Paragraph&gt;&lt;/TableCell&gt;&lt;TableCell Padding=''7.2,0,7.2,0'' BorderThickness=''1.33,1.33,1.33,1.33'' BorderBrush=''#FF000000''&gt;&lt;Paragraph Margin=''0,0,0,0'' TextAlignment=''Left'' FontFamily=''Arial'' FontWeight=''Bold'' FontSize=''16''&gt;&lt;Span Foreground=''#FF808080'' &gt;S/RMP/SRS&lt;/Span&gt;&lt;/Paragraph&gt;&lt;/TableCell&gt;&lt;/TableRow&gt;&lt;/TableRowGroup&gt;&lt;/Table&gt;&lt;Paragraph /&gt;&lt;/FlowDocument&gt;</TemplateData> <TemplateTypeId>5f974901-3342-4805-ab01-4b8b2b4fd49e</TemplateTypeId> <BCC /> <CC /> <Subject /> <To /> </DocumentTemplates></NewDataSet>'DECLARE @CHECKIDENTITY INTSELECT @CHECKIDENTITY = OBJECTPROPERTY(OBJECT_ID('[Forms]'),'TableHasIdentity') Select * into #tmp from Forms DECLARE @idcol VARCHAR(100) DECLARE @colType VARCHAR(100) BEGININSERTINTO Forms SELECT * FROMOPENXML (@hdoc, '/NewDataSet/Forms', 1) WITH Forms wherecast(Id asnvarchar(max)) notin (selectcast(Forms.Id asnvarchar(max))from Forms ) update Forms set Forms.[Layout]=TempAlias.[Layout] ,Forms.[Binding]=TempAlias.[Binding] ,Forms.[Version]=TempAlias.[Version] FROMOPENXML (@hdoc, '/NewDataSet/Forms', 1) WITH #tmp TempAlias where Forms.[Id]=TempAlias.[Id] ENDEXEC sp_xml_removedocument @hDoc IFobject_id('tempdb..#TempAlias') ISNOTNULLBEGINDROPTABLE #TempAlias ENDIFobject_id('tempdb..#tmp') ISNOTNULLBEGINDROPTABLE #tmp END
the error is

Msg 6602, Level 16, State 2, Procedure sp_xml_preparedocument, Line 1

The error description is 'An invalid character was found in text content.'


please help me its stopping my work, thanks in advance.


I have the following code:-

var content = "Hello – Testing";


The webbrowser displays it as "Hello   Testing", doesn't shows this "–" character.

and desktop wpf webbrowser also doesn't displays it properly: "hello – testing".

Also i think there are some more character's which are not displayed properly by webbrowser control but other controls like TextBlock work fine.

Any Solution ?



I wonder if its possible to enable script debugging facilities when hosting the WebBrowser control in my app.

I would like to step through my javascript files that are used in the webpage displayed inside the browser control.

How to set font size programmatically (VB or C#) in WebBrowser control or zoom WebBrowser control


I saw in IE8 there are profiling APIs and an associated entry in the developper toolbar.



My question is: (how)can I use the Profiling API in a CHTMLView hosting the WebBrowser control ?

I saw we can profil IActiveScript but I don't have an access this interface...


Dear all, 


We are facing a quite strange issue while using sql server 2005 and a .Net 2.0 C# application. 

Here is the code sample in the application that fails :



    PublicFunction GetManifSales(ByVal sManifRef AsString, ByVal bIsModel As Boolean) As APP.AppStructure.strMatchStatus()


        Dim iRecs As Integer

        Dim sCommand As String

        Dim oSQLReader As SqlDataReader

        Dim oSQLCommand AsNew SqlCommand()

        Dim oMatchStatus() As APP.AppStructure.strMatchStatus


        bLastCommandSuccessful = APP.AppStructure.appSuccess.iUndefinded


            If IsGuid(sManifRef) = TrueThen

                sCommand = "SELECT appManifSection.Name + ' - ' + appManifSection.SubSection AS [Section], appManifSection.TotalSeats, appManifSection.FreeSeats + appManifSection.MarkedSeats AS FreeSeats, appManifSection.SeasTickSeats + appManifSection.SoldSeats AS SoldSeats, appManifSection.BlockedSeats + appManifSection.NotDispoSeats + appManifSection.ReservedSeats + appManifSection.BlockedByCodeSeats AS OccupiedSeats, appManifSection.OnSaleSeats AS OnSaleSeats"

                sCommand = sCommand & " FROM appManifSection"

                sCommand = sCommand & " WHERE appManifSection.ManifRef = '" & sManifRef & "'"

                sCommand = sCommand & " ORDER BY [Order], appManifSection.Name, appManifSection.SubSection"


                oSQLCommand = New SqlCommand(sCommand, oDataCon)

                oSQLReader = oSQLCommand.ExecuteReader()


                While oSQLReader.Read = True

                    If (iRecs Mod 128) = 0 Then

                        ReDimPreserve oMatchStatus(iRecs + 128)



                    oMatchStatus(iRecs).sSection = oSQLReader.Item("Section").ToString

                    oMatchStatus(iRecs).iTotalSeats = CInt(oSQLReader.Item("TotalSeats"))

                    oMatchStatus(iRecs).iFreeSeats = CInt(oSQLReader.Item("FreeSeats"))

                    oMatchStatus(iRecs).iSoldSeats = CInt(oSQLReader.Item("SoldSeats"))

                    oMatchStatus(iRecs).iOccupiedSeats = CInt(oSQLReader.Item("OccupiedSeats"))

                    oMatchStatus(iRecs).iOnSaleSeats = CInt(oSQLReader.Item("OnSaleSeats"))


                    iRecs = iRecs + 1



                If iRecs > 0 Then

                    iRecs = iRecs - 1

                    ReDimPreserve oMatchStatus(iRecs)


                    oMatchStatus = Nothing





                bLastCommandSuccessful = APP.AppStructure.appSuccess.iSuccess



            oMatchStatus = Nothing

            bLastCommandSuccessful = APP.AppStructure.appSuccess.iFailure

            oErrorLog.AddWithTrace(sThisObject, "GetManifSales", Err, sCommand)


            Call CloseSQLCommand(oDataCon, Nothing, oSQLCommand, oSQLReader)



        Return oMatchStatus





We launch the SQL Profiler on the SQL server in order to trace the sql which is launch. Sometimes, the query is modified by the driver itself and some strange character are injected in the query. for example a "1" is added at the end of the query. Logically the server return an exception. The issue is that on the client side we logged the query which is well formatted. 

Does anyone has heard about issues on the ado.net driver which add or replace some query charaters ???


Any help will be appreciate....





I am getting the following error while im getting trailing zeros in the data. The error is,

Unable to read the stream produced by the pipeline.
 Details: Error: 1 (Field level error)
    SegmentID: AMT
    Position in TS: 13
    Data Element ID: AMT02
    Position in Segment: 2
    Data Value: 36.00
    6: Invalid character in data element

Im using EDI 850 schema. I tried to resolve this error by enabling the check box 'Allow leading and trailing zeros and spaces' in the Party properties. Then also this problem continues.

If I changed the data '36.00' into '36.01' in the receiving data the error is not coming.

I dono what would be the problem. I need to solve this problem ASAP.

Plz help me ASAP.






privatevoid encode_base64()



constlong k_max_file_size = 2000000;


constint k_data_buf_size = 32000;


byte[] data_buf1 = newbyte[k_data_buf_size];


char[] data_buf2 = newchar[k_data_buf_size];


int bytes_read;


string s="C:\\Documents and Settings\\Administrator.IHSDUBAI\\My Documents\\Visual Studio 2008\\WebSites\\IHSOnline\\admin\\Textarea.htm";


FileStream fs=newFileStream(s,FileMode.Open,FileAccess.Read);


BinaryReader br=newBinaryReader(fs);







while (bytes_read > 0)


m_file_size = m_file_size + bytes_read;

bytes_read = br.Read(data_buf1, 0, k_data_buf_size);




catch (Exception ex)



">", ex.ToString());

lblmsg.Text = ex.Message;



">", "File size = " + m_file_size.ToString());


if (m_file_size > k_max_file_size)



">", "File size exceeds maximum allowed");





//Attempt to read the file contents and encode as base 64 ...






BinaryReader br1=newBinaryReader(fs);


MemoryStream ms=newMemoryStream();


// Loop to read data into memory stream

bytes_read = br.Read( data_buf1, 0, k_data_buf_size );


while ( bytes_read > 0 )


ms.Write(data_buf1, 0, bytes_read);

bytes_read = br.Read(data_buf1, 0, k_data_buf_size);



//Convert the data to base 64 ..

m_encoded_data =




catch (Exception ex)



">", ex.ToString());

lblmsg.Text = ex.Message;













publicbyte[] decode_base64()



byte[] data_array ;


constint k_data_buf_size = 4096;


char[] data_buf2 = newchar[k_data_buf_size];


">", "==============" );


">", "decode_base64:" );


StreamReader sr = newStreamReader("C:\\Documents and Settings\\Administrator.IHSDUBAI\\My Documents\\Visual Studio 2008\\WebSites\\IHSOnline\\admin\\Textarea.htm");

// Attempt to decode from base64 ...






int bytes_read;

bytes_read = sr.Read(data_buf2, 0, k_data_buf_size);


while (bytes_read > 0)


m_file_size = m_file_size + bytes_read;

bytes_read = sr.Read(data_buf2, 0, k_data_buf_size);


data_array =



">", "data_array.length = " + data_array.Length.ToString() );



if (data_array.Length == m_file_size)



">", "DECODE OK");










catch(Exception ex)



">", ex.ToString() );







when i run

FromBase64String function showing error:Invalid character in a Base-64 string...

I want to read an html file(contains text and image) and store it to database(image field) and then retrieve it from database and show in gridview

Please help me to do this


I am developing a SSIS package to add data from an XML file to an existing SQL Server table.  I have completed several similar projects, but on this XML file I am getting the error from the Data Flow tab between the XML Task and Data Flow Task:

Error: 0xC002F304 at XML Task, XML Task: An error occurred with the following error message: 

"'', hexadecimal value 0x15, is an invalid character. Line 28, position 54.".

Error: 0xC002928F at XML Task, XML Task: Property "New Source" has no source Xml text; 

Xml Text is either invalid, null or empty string.

Task failed: XML Task

Warning: 0x80019002 at zSTU_TS_Element: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED. The Execution method succeeded, but the number of errors raised (2) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the errors.

SSIS package "zStu_TS_Element.dtsx" finished: Failure.

Do you know how I can fix this?

This is the line it is referring to:

<z:row c0='12' c1='80' c2='2006-04-17' c3='539' c4='1M2083N4N5N6N75800901110 11 '/>


I have been unable to synchronize my MS Project with a SharePoint Foundation tasks list. Each time I try I get the following message:

"Unable to synchronize the project with the SharePoint tasks list because the list name contains invalid characters. Modify the list name and synchronize again. Valid list names cannot contain any of the following characters: !.[]'"

I click OK and the process stops. It creates the Task list in SharePoint but does no more.

The SharePoint task list name is not the issue. I've tried a few (Project Tasks, tasks etc). It's not the Task Name in Project either. I'm using a test project file with only two tasks called "Startup" and "planning".

Any ideas?


I'm testing a product that uses a Windows.Controls.WebBrowser object for Javascript execution. One of my tests is to have the WebBrowser object to run a broken script and verify the JavaScript error.

For Windows.Forms.WebBrowser object I can get the error by handling the WebBrowser.Document.Window.Error event. What is the equivalent event for the WPF WebBrowser object?

Are there another other techniques I can capture the error message? I have to somehow verify the error message in the test code that is written in C#, so I can't just create the try..catch block in JavaScript to capture the error.



By clicking on this post you thought this was going to be an easy answer, if only that was the case :)

I'm putting together a webbrowser and I thought I had all the bugs sorted out until someone showed me a scripting popup box within our corporate website.

If I take a step back all I need to achieve is

·          All scripting errors are hidden from the user

·          Webpage login box’s are presented to the user (required for access to some external vendors)

So I’m using the .Net Webbrowser and I know I need scripterrorsuppressed set to false as if it is set to true then I won’t see any login boxes (or will I, can you filter this?)

I have hooked into the Document.error event to trap normal script popup boxes and set handle to true, this works most of the time. But the issue I having is that this event is not being triggered for this scripting error, I know my code works in general as if I browse around the web I can see this event being triggered, just not on this error. I think the issue is that it is a frame and hence the Document.error isn’t being triggered.

Has anyone else had this problem where Document.error didn’t prevent all your scripting error boxes popping up?

Right now the only site I can replicate this on is my our corporate site, I’ll see if I can find a public site that I can also replicate this error on and post the link.

Also do I now need to think outside the box and not try to prevent the script errors poping up by hide the popbox e.g. visible = false or even kill them on title, any thoughts on this?


        public Form1()





            webBrowser1.ScriptErrorsSuppressed = false;

            webBrowser1.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(browser_DocumentCompleted);

            webBrowser1.Navigated += new WebBrowserNavigatedEventHandler(webBrowser1_Navigated);





        void webBrowser1_Navigated(object sender, WebBrowserNavigatedEventArgs e)


            ((WebBrowser)sender).Document.Window.Error += newHtmlElementErrorEventHandler(Window_Error);





        privatevoid textBox1_KeyDown(object sender, KeyEventArgs e)


            if (e.KeyCode == Keys.Return)








        privatevoid browser_DocumentCompleted(object sender,WebBrowserDocumentCompletedEventArgs e)


            ((WebBrowser)sender).Document.Window.Error += newHtmlElementErrorEventHandler(Window_Error);





        privatevoid Window_Error(object sender,HtmlElementErrorEventArgs e)


            // Ignore the error and suppress the error dialog box.

            e.Handled = false;





After a bit of surfing with the above code the only website that kind of produced the same error was http://entertainment.msn.co.nz/tv-guide?starttime=Sat Jul 31 09:11:39 UTC+1200 2010&channelset=1 , it proceduces a different error but it still bypasses the error event on one of the script errors, so the question is how is it triggered if it isn't being triggered in the error event. 


The error I'm getting is due to the value not being defined eg Error 'sys' is undefined


Some pages when I open them with WebBrowser tool by typing the URL in a TextBox, a Script Error appears, like this one:




So what is the problem?



i am using watin with webbrowser control, on vista with vs2008, its giving timeout exception, i need to use watin with embedded browser, please can you provide help regarding the same, i have added the site to trust zone, as mentioned in the above article. here is my code.

var t = new Thread(() =>
Settings.AutoStartDialogWatcher = false;
var ie = new IE(webBrowser1.ActiveXInstance);
catch (Exception) { }


thank you.

How to Suppress Javascript Errors in WPF WebBrowser control, that was released in .NET3.5 SP1?

Hi All,

  I am facing one strange issue in SSIS 2008. I have developed one SSIS package which is importing excel data into SQL Server 2008. This Package contains some Scirpt componants. This package is working fine on Windows XP machine but when I am trying to run on Windows 2003 server it gives me error "[SSIS.Pipeline] Error: component "SCR RDSTableRelation" (48) failed the post-execute phase and returned error code 0x80004002". Surprising thing is that if on windows server 2003server  if I drag a new script componat and paste the previous script code itself then it works fine. Even if I copy-paste the existing script componant and give source-destination connectino to this new script componant then also it works.



i have grideview and i want to bind silverlight media control as follow


<asp:Media...etc MediaSource="<%#Eval('Source')%>"






As above.  I like to know if the below work:

in the page, have 1 WebBrowser Control

1. Does it support Microsoft or google Map . 

2. How Do I embed a Html file in the project ? Embed it as Content file?

3. Base on (2).  Does WebBrowser Control support when the html file contain :

  Microsoft Map Control such as  VeMap ( ie map = new VEMap() Or the latest)

 or google Map Control similiar to VeMap Control of microsoft

4) How Do I pass data captured from Page to Html








I have a problem displaying MHT content in my webbrowser control (IE7/IE8)
It works if I open the .mht file from my harddisk like so:

myWebbrowserControl.Navigate "c:\test.mht" 

But I need to display the MHT content that is in a string variable.
So instead opening the MHT content from harddisk I need to display the MHT from a string.

The MHT string looks like this :

From: <saved with Windows Internet Explorer 8>
Subject: Welcome to my website
Date: Sat, 14 Aug 2010 22:43:27 +0200
MIME-Version: 1.0
Content-Type: multipart/related;
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5931

This is a multi-part message in MIME format.

Content-Type: text/html;
Content-Transfer-Encoding: quoted-printable
Content-Location: http://www.mywebsite.com

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns=3D"http://www.w3.org/TR/REC-html40" xmlns:v =3D=20
"urn:schemas-microsoft-com:vml" xmlns:o =3D=20
"urn:schemas-microsoft-com:.....  (+base64)

I try to display the string like so :

myWebbrowserControl.Navigate "about:blank"
myWebbrowserControl.Document.Write testMHT 

This displays the source - but it doesnt render the MHT string.
 Thank you


I have a web browser control and have a page loaded in it lets say www.gmail.com.

I want to provide some custom functionality to my end user for example, I want my user to be able to right click the firstname, lastname textboxes and the create new account button. On right click, I want to show my custom context menu with some options and want to determine the type of control (button, textbox etc) user has clicked and also the name or id of that control.

Is that possible?





<< Previous      Next >>

Microsoft   |   Windows   |   Visual Studio   |   Sharepoint   |   Azure