c# programmatically opening web browser with url

Its simplest thing I’ve done till date.

But you have to know what you need to do.

 

I read c# books to get to know how to do it but you landed on this page

Alright let me show you.

Add these few lines to your code, change the URL btw 🙂

[geshi lang=”csharp” nums=”1″ target=”_self” ]

 

 

I hope this helps.

P.S. I am not a C# expert but know few things :). You should always consult other search results in Google before trying anycode. But you can take my word that above will work.

 

Comments

  1. Thanks for this. After opening this URL, how to get the browser to print the page programmatically?

    • I am not sure if you can do it with c# unless you are using WebBrowser control.

      Other thing I would do it inject a little javascript at the end of the page with this code in it, if single motive of that page is to load and print.

      <script type="text/javascript">
      window.print();
      </script>

      Or you can use this

      <body onload="window.print(); ">
      hope this helps

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.