title: Invalid URI: Invalid port specified in C# on specifying URL with port number in it like http://localhost:8080/jasperserver/rest
body: <p>I created a simple function to execute an Http PUT request - </p>
  
  <pre><code>public string checkIfUserExists(string userName)
      {
          var endPoint = new Uri("http://localhost:8080/jasperserver/rest_v2/users/"+userName);
  
          var request = (HttpWebRequest)WebRequest.Create(endPoint);
          request.Method = "PUT";
          request.ContentType = "urlencoded";
  
          var response = (HttpWebResponse)request.GetResponse();
  
          return "Success";
      }
  </code></pre>
  
  <p>when I execute this, I get an exception "Invalid URI: Invalid port specified" at the line -</p>
  
  <pre><code>var endPoint = new Uri("http://localhost:8080/jasperserver/rest_v2/users/"+userName);
  </code></pre>
  
  <p>Any ideas for fixing this? Is the problem with localhost:8080 portion of the URL?</p>