从C#Windows应用程序调用URL

Sha*_*eem 1 c# windows-applications

我有一个将短信发送到提供的手机号码的网址。我只想从Windows应用程序中调用此URL,但不要在浏览器中打开。我只想从Windows应用程序执行该URL。

网址示例

    http://mycompany.com/sms.aspx?mobilenum=9123444777&Message=this is a test message
Run Code Online (Sandbox Code Playgroud)

我已经尝试过这种方式。但是它正在浏览器中打开。我不希望在浏览器中打开它。我只想在内部执行此行。

    System.Diagnostics.ProcessStartInfo sInfo = new     
    System.Diagnostics.ProcessStartInfo("http://mycompany.com
    /sms.aspx?mobilenum=9123444777&Message=this is a test message");
    System.Diagnostics.Process.Start(sInfo);
Run Code Online (Sandbox Code Playgroud)

谢谢。

kjb*_*tel 5

您是否尝试过使用HttpWebRequest

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(@"http://mycompany.com/sms.aspx?mobilenum=9123444777&Message=this%20is%20a%20test%20message");
WebResponse response = request.GetResponse();
response.Close(); 
Run Code Online (Sandbox Code Playgroud)