Starting a command line browser

Posted by: Thom Robbins .NET Weblog, on 01 Nov 2006 | View original | Bookmarked: 0 time(s)

Question: I have what may sound like a bit odd of a question that I am hoping you may be able to help with or point me in the right direction. There is a console application that is used in part of our application. It has been a fairly long time since I had to write one of these and it has been a definite challenge. There is one problem that I cant seem to figure out. In part of the application I need to open a web page. Any ideas on how I can do this?

Answer: Long live the mighty console application! Within a console application the system.Diagnostics.Process.start function should do the trick. This starts the process associated with a string. In this case the browser when a URL is entered.

The following code is a simple example of accepting a URL entered by the user and the starting the browser.

 

Imports System.io

Module Module1

 

    Sub Main()

        Dim uIn As TextReader = Console.In

        Dim uOut As TextWriter = Console.Out

 

 

        uOut.WriteLine("Command Line Launcher")

        uOut.Write("Enter the URL to load: ")

        Dim name As String = uIn.ReadLine()

        '' Enter the URL - http://blogs.msdn.com/trobbins

        Process.Start(name)

    End Sub

 

End Module

Category: .NET | Other Posts: View all posts by this blogger | Report as irrelevant | View bloggers stats | Views: 1069 | Hits: 63

Similar Posts

  • Eschewing Date Types in our Database more
  • The Telerik CAB Enabling Kit and SCSF - Tutorial 5: The RadPanelBar UIExtensionSite more
  • PowerBoots makes me want to use PowerShell! more
  • UppercuT - Automated Builds - Getting Started Part 0 (Prerequisites) more
  • Managing Silverlight 3 navigation behavior more
  • What is your enterprise "angle of the diagonal" of the investment in application maintenance? more
  • My Latest Book – Professional ASP.NET 3.5 AJAX more
  • Setting up for Watin testing more
  • SharePoint Developer Tools: Announcing Public CTP Release of VSeWSS 1.3 more
  • Get SOLID: Single Responsibility Principle more

News Categories

.NET | Agile | Ajax | Architecture | ASP.NET | BizTalk | C# | Certification | Data | DataGrid | DataSet | Debugger | DotNetNuke | Events | GridView | IIS | Indigo | JavaScript | Mobile | Mono | Patterns and Practices | Performance | Podcast | Refactor | Regex | Security | Sharepoint | Silverlight | Smart Client Applications | Software | SQL | VB.NET | Visual Studio | W3 | WCF | WinFx | WPF | WSE | XAML | XLinq | XML | XSD