title: Process.Start url with hidden WindowStyle
body: <p>I have a url that authenticates my credentials on a server. Is there a way to make it invisible? The simple code looks exactly like this:</p>
  
  <pre><code>public void DoAuth()
      {
          String uri = GetUri();
          ProcessStartInfo startInfo = new ProcessStartInfo(uri);
          startInfo.WindowStyle = ProcessWindowStyle.Hidden;
          Process.Start(startInfo);
  
      }
  </code></pre>
  
  <p>however <code>ProcessWindowStyle.Hidden</code> doesn't seem to do the trick. If I set <code>UseShellExecute</code> to false then I get <code>Win32Exception</code> with the message <code>The system cannot find the file specified</code>
  The url is a authentication on Spotify server to get the playlists and it looks something like this <code>https://accounts.spotify.com/authorize/client_id=26d287105as12315e12ds56e31491889f3cd293..</code></p>
  
  <p>Is there an other way to make this process invisible?</p>
  
  <p>Edit: http sample</p>
  
  <pre><code>public void DoAuth()
      {
          String uri = GetUri();
  
          HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
          HttpWebResponse webResponse;
          try
          {
              webResponse = (HttpWebResponse)request.GetResponse();
              Console.WriteLine("Error code: {0}", webResponse.StatusCode);
              using (Stream data = webResponse.GetResponseStream())
              using (var reader = new StreamReader(data))
              {
                  //do what here?
              }
          }
          catch (Exception e)
          {
              throw;
          }
      }
  </code></pre>
  
  <p>The entire .cs file containing the sample above:</p>
  
  <pre><code>using SpotifyAPI.Web.Enums;
  using SpotifyAPI.Web.Models;
  using System;
  using System.IO;
  using System.Net;
  using System.Text;
  using System.Threading;
  
  namespace SpotifyAPI.Web.Auth
  {
      public class ImplicitGrantAuth
      {
          public delegate void OnResponseReceived(Token token, String state);
  
          private SimpleHttpServer _httpServer;
          private Thread _httpThread;
          public String ClientId { get; set; }
          public String RedirectUri { get; set; }
          public String State { get; set; }
          public Scope Scope { get; set; }
          public Boolean ShowDialog { get; set; }
  
          public event OnResponseReceived OnResponseReceivedEvent;
  
          /// &lt;summary&gt;
          ///     Start the auth process (Make sure the internal HTTP-Server ist started)
          /// &lt;/summary&gt;
          public void DoAuth()
          {
              String uri = GetUri();
  
              HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
              HttpWebResponse webResponse;
              try
              {
                  webResponse = (HttpWebResponse)request.GetResponse();
                  Console.WriteLine("Error code: {0}", webResponse.StatusCode);
                  using (Stream data = webResponse.GetResponseStream())
                  using (var reader = new StreamReader(data))
                  {
                      //nothing
                  }
              }
              catch (Exception e)
              {
                  throw;
              }
  
  
              /*ProcessStartInfo startInfo = new ProcessStartInfo(uri);
              startInfo.WindowStyle = ProcessWindowStyle.Hidden;
              Process.Start(startInfo);
              */
          }
  
          private String GetUri()
          {
              StringBuilder builder = new StringBuilder("https://accounts.spotify.com/authorize/?");
              builder.Append("client_id=" + ClientId);
              builder.Append("&amp;response_type=token");
              builder.Append("&amp;redirect_uri=" + RedirectUri);
              builder.Append("&amp;state=" + State);
              builder.Append("&amp;scope=" + Scope.GetStringAttribute(" "));
              builder.Append("&amp;show_dialog=" + ShowDialog);
              return builder.ToString();
          }
  
          /// &lt;summary&gt;
          ///     Start the internal HTTP-Server
          /// &lt;/summary&gt;
          public void StartHttpServer(int port = 80)
          {
              _httpServer = new SimpleHttpServer(port, AuthType.Implicit);
              _httpServer.OnAuth += HttpServerOnOnAuth;
  
              _httpThread = new Thread(_httpServer.Listen);
              _httpThread.Start();
          }
  
          private void HttpServerOnOnAuth(AuthEventArgs e)
          {
              OnResponseReceivedEvent?.Invoke(new Token
              {
                  AccessToken = e.Code,
                  TokenType = e.TokenType,
                  ExpiresIn = e.ExpiresIn,
                  Error = e.Error
              }, e.State);
          }
  
          /// &lt;summary&gt;
          ///     This will stop the internal HTTP-Server (Should be called after you got the Token)
          /// &lt;/summary&gt;
          public void StopHttpServer()
          {
              _httpServer.Dispose();
              _httpServer = null;
          }
      }
  }
  </code></pre>
  
  <p>And they are called like this:</p>
  
  <pre><code>_auth.OnResponseReceivedEvent += _auth_OnResponseReceivedEvent;
  _auth.StartHttpServer(8000);
  _auth.DoAuth();
  </code></pre>
  
  <p>The github url with a full runnable sampe is here: <a href="https://github.com/JohnnyCrazy/SpotifyAPI-NET">https://github.com/JohnnyCrazy/SpotifyAPI-NET</a>
  Download it and run the Spotify Test to connect to Spotify's web api to reproduce the sample I have.</p>