I am using the System.Diagnostics.Process.Start()
to run a URL, but every time I execute the function, it opens a new browser tab. How can I just access the link without open the browser?
Asked
Active
Viewed 52 times
-2

Cipher
- 9
- 1
-
Maybe this can help you [wget](https://eternallybored.org/misc/wget/) for Windows – Shim-Sao May 05 '19 at 03:30
-
Trying to explain it in more details, I have a web server, with some buttons to control things in my house, like turn lights on and off, for example. In visual studio I have an application to access the links of the buttons by voice commands, but for each command I execute,Visual studio opens a browser tab. I just want to send a http request to the server, without open the browser. – Cipher May 05 '19 at 03:40
-
Look at this post for [Http Get & Post Request](https://stackoverflow.com/questions/4015324/how-to-make-http-post-web-request) – Shim-Sao May 05 '19 at 03:52
1 Answers
0
If all you need is to just access a URL without needing any interaction (i.e. just do a HTTP Get), then I think you should probably use WebClient.
Basically, instead of calling System.Diagnostics.Process.Start()
, you do this:
using (WebClient wc = new WebClient())
{
var result = wc.DownloadString(url); //where url is the url you intend to access
}
Depending on your usage scenario, you may want to call the wc.DownloadStringAsync
if you do not want to hold up the UI thread.

VT Chiew
- 663
- 5
- 19