Friday, January 7, 2011

How to open a webpage in current browser

Here i will show how you can open a webpage in a defualt browser.

 

 string url = "url from user";
           
            // check http included or not
            if (!url.ToLower().StartsWith("http://"))
            {
                 // if not the add http
                url = "http://" + url;
             }
             // it will open a url in current default browser
           System.Diagnostics.Process.Start(url);

No comments:

Post a Comment