Invalid URI: Invalid port specified in C# on specifying URL with port number in it like http://localhost:8080/jasperserver/rest

what does invalid uri mean
c# uri invalid
.net invalid uri
pack uri: invalid port specified
invalid uri path
invalid uri: the hostname could not be parsed
invaliduri
message invalid uri: the format of the uri could not be determined string

I created a simple function to execute an Http PUT request -

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";
    }

when I execute this, I get an exception "Invalid URI: Invalid port specified" at the line -

var endPoint = new Uri("http://localhost:8080/jasperserver/rest_v2/users/"+userName);

Any ideas for fixing this? Is the problem with localhost:8080 portion of the URL?

Have a look at this question Invalid URI: Invalid port specified when url has more than one colon

Have you checked your username for characters that could cause a problem?

EDIT after comment - The reason that I referenced this question was because the 'Invalid Port' error occurred not because the actual port was wrong, but because of other invalid characters in the URL. Validating that the username is correctly encoded will prevent this problem.

var endPoint = new Uri("http://localhost:8080/jasperserver/rest_v2/users/" 
      + HttpUtility.UrlEncode(userName));

Invalid URI: Invalid port specified in C# on specifying URL , Invalid URI: Invalid port specified in C# on specifying URL with port number in it like http://localhost:8080/jasperserver/rest -. Get link; Facebook� System.UriFormatException : Invalid URI: Invalid port specified. in c# Hot Network Questions Why is it a convention to number modes by their tonic scale degree relative to ionian (major)?

I fixed this error using string.Concat() method:-

var endPoint = new Uri(string.Concat("http://localhost:8080/jasperserver/rest_v2/users/", userName));

Invalid uri invalid port specified in c on specifying url with po, Invalid URI: Invalid port specified in C# on specifying URL with port number in it like http://localhost:8080/jasperserver/rest location: linuxexchange.com - date:� When using the Uri builder you need to put the host, port & path as it's own line. Also TestService.svc is also part of the path and not the host, you can get away with it if not using port but with port they have to be separated out.

Make sure you're using something like https://msdn.microsoft.com/en-us/library/system.web.httputility.urlencode%28v=vs.110%29.aspx on the userName param before you concat it to the URL.

c#, Invalid URI: Invalid port specified in C# on specifying URL with port number in it like http://localhost:8080/jasperserver/rest. 发表于 2015-03-31� This article show how to select a specific page and port in the Web API. Here we define the specific port for execution of the application. The application can execute on the defined specific port. Now let's see the example of the application. Create an Web API Application. Start Visual Studio 2012. From the Start window select "New Project".

I was facing this problem and found out that it is my carelessness causes this issue. I was getting the issue while I create an instance of HttpRequestMessage as follows.

var request = new HttpRequestMessage(new HttpMethod("PUT"), 
                    $"{_nextcloudConfigurationProvider.NextcloudBaseUrl}{FileConstants.ApiUploadFile.Replace("{UserName}", UserName)}");

The issue was I missed a slash "/" before my second constant. It was remote.php/dav/files/{UserName}/{directoryName}/ instead of /remote.php/dav/files/{UserName}/{directoryName}/. Adding the slash fixed the issue for me.

Just sharing this for the people who miss silly things, like me.

Invalid URI: Invalid port specified � Issue #3 � brcontainer , Attached is the error. I'm trying to create a screenshot of a Google Map. This code was working for several years until recently. The original proof� Note that the EPR inside wsdl:port replaces soap:Address as seen in the following example. Defining Endpoint Addresses in Code. An endpoint address can be created in code with the EndpointAddress class. The URI specified for the endpoint address can be a fully-qualified path or a path that is relative to the service's base address.

HTTP Error 405 Method Not Allowed: How to fix the status code 405 , HTTP Error “405 Method Not Allowed”: How to solve the problem. Web servers inform clients, like internet browsers for example, about the processing The Hypertext Transfer Protocol (HTTP for short) defines methods that indicate which are needed to specify settings for one or more desired URLs. If the port number is not specified, the default port 27017 is used. /defaultauthdb: Optional. The authentication database to use if the connection string includes username:password@ authentication credentials but the authSource option is unspecified.

[PDF] JasperReports Server REST API Reference, http://<host>:<port>/jasperserver[-pro]/rest/GetEncryptionKey installation, you should specify the user ID without any qualifiers, for example GET http:// localhost:8080/jasperserver-pro/j_spring_security_check?ticket=ST-40- invalid . 404 Not Found – If the resource in the URL is invalid. 9.5. Setting a Like the jobModel,. For example, look at the endpoint ServiceEndpoint1 specified in the manifest snippet provided after this paragraph. Additionally, services can also request a specific port in a resource. Service replicas running on different cluster nodes can be assigned different port numbers, while replicas of a service running on the same node share the port.

using REST service from Asp.Net, UploadString("http://localhost:8080/jasperserver/rest/resources/reports/samples/ http://<host>:<port>/jasperserver[-pro]/rest/report/path/to/report. So in your case your code should look like this: That is assuming your report URI is "/reports/ samples/testreport". I have given the following url for rest_v2: OAuth guide. When working with the Dropbox APIs, your app will access the Dropbox service on behalf of your users. You'll need to have each user of your app authenticate with Dropbox to both verify their identity and give your app permission to access their data on Dropbox.

Comments
  • I actually looked at this post before posting mine. I am slightly confused about- NetworkCredential(string, string) function. It takes 2 input strings but I have to pass only 1 string userid. It doesn't seem to have an overload which accepts 1 input parameter.
  • See my edit - the NetworkCredential section is a bit misleading, the point was that the error does not have to be caused by the specified port