What does ~ in the beginning of an URL in asp.net exactly do ?

Posted by MarceloRamires on Stack Overflow See other posts from Stack Overflow or by MarceloRamires
Published on 2010-03-17T12:19:41Z Indexed on 2010/03/17 12:21 UTC
Read the original article Hit count: 291

Filed under:
|
|
|

I am editing a certain website which before used the port 80 (default) that was not required at the url (because it's default..)

But the port had (for technical reasons) to be changed, and now it has to be informed.

I can access the main page through ip:port\page like this:

1.2.3.4:81\page.aspx

Every link in the website is composed like this:

<asp:HyperLink runat="server" Text="random" NavigateUrl="~/fdr/whatever.aspx" />

And whenever I click on a link, the page doesn't load, but the URL is composed on the URL bar of the browser, then I simply add ":80" after the IP in the URL and it works.

Due to the existance of querystrings (in other words, for already having access to the URL) I before thought that '~' in the beginning of a URL in a link was saying "keep in the same website, just change to this webpage in this folder", but if the port vanishes, I assume now that the address is requested (probably to IIS) the location of the current website.

I want to know then (instead of having to add the port to each link in my website) how do I set up whoever is requested by the ~ in the link to add the port somehow. How do I do that?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about .NET