DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: Call a webpage with a command line c# program  (Read 6,172 times)

mediaguycouk

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 247
Call a webpage with a command line c# program
« on: March 25, 2009, 03:23 PM »
I'm converting a Form based C# application to an automatic command line based C# version. However I need to call a webpage (like a cron job would), but I don't know how to do it from the command line. In a form I would call play.webBrowser1.Url = new Uri(address); (after calling the play class that has a web browser element).

Anyone help with this? I don't think I need any feedback from the page at all.
Learning C# - Graham Robinson

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • Coding Snacks
Re: Call a webpage with a command line c# program
« Reply #1 on: March 25, 2009, 06:23 PM »
If you just want to launch the default browser use ShellExecture() API

http://msdn.microsoft.com/en-us/library/bb762153(VS.85).aspx

Use the URL in double quotes as the "filename" and the 'open' verb
Handle, Working dir and all the rest can be NULL or 0
« Last Edit: March 25, 2009, 06:24 PM by MilesAhead »

Original address: https://www.donationcoder.com/forum/index.php?topic=17613.0