sshah
sshah

Reputation: 63

Hyperlink url contains localhost and port number

I am creating a searching website using ASP.NET .On my one page I show URL of results.When I click on URL a new link is open but the URL path for the new link in the browser include loalhost:portnumbet.I do not want this in my URL.

For eg.

    <a href = "https://www.google.com"> result </a>

so on clicking result I go to browser where the URL is "https://localhost:8080//www.google.com" why this localhost:8080 includes in the URL.

Thanks

Upvotes: 3

Views: 2055

Answers (1)

Kinexus
Kinexus

Reputation: 12904

When you are redirecting to the URL, you will not be adding any protocol information, so it will default to the current website/protocol.

For example;

Response.Redirect("www.google.com")

is not the same as;

Response.Redirect("http://www.google.com")

You need to add the fully qualified URL, otherwise it will believe it to berelative to the current website, therefore add the http(s):// to the redirect.

Upvotes: 3

Related Questions