Mitesh Khatri
Mitesh Khatri

Reputation: 3955

How to disable webbrowser security warning in WPF c#

I am using webbrowser control in my WPF application using VS 2010 (C#). and I am displaying a local html with js file in my webbrowser. and it displaying the security warning. So can anyone suggest how can i disable this security warning.enter image description here

After adding the below line:

"<!-- saved from url=(0016)http://localhost -->"

It display below error: enter image description here

Upvotes: 3

Views: 3353

Answers (3)

kamil.ka
kamil.ka

Reputation: 160

I tried to load html file using system path and mark of the web wasn't enough. So besides

<!-- saved from url=(0014)about:internet --> 

as a first line in my html file I also had to transform my path to html file (C:\somedir\somefile.html) into

file://127.0.0.1/c$/somedir/somefile.html

code example:

string somePath = @"C:\somedir\somefile.html".Replace(@"C:\", "file://127.0.0.1/c$/");

Upvotes: 0

steviesama
steviesama

Reputation: 337

The local host and code 16 from the other answer didn't work for me; however I think there must be a newer solution as this following version on the first line of HTML before worked for me. This is VS 2013 for reference.

<!-- saved from url=(0014)about:internet -->

Upvotes: 3

Alexei Levenkov
Alexei Levenkov

Reputation: 100620

You need to add mark of the web to you local HTML. Add following to very beginning of you HTML file:

  <!-- saved from url=(0016)http://localhost -->

Upvotes: 5

Related Questions