title: Asp.NET link: Page losing port number
body: <p>In this asp.net page, there is a link that leads to another page in a certain subfolder, It has always worked.</p>
  
  <p>Recently, for technical reasons (irrelevant) , the port number had to be changed (80 to 81). Every link keeps working, but there is ONE that doesn't keep the port number no matter what.</p>
  
  <pre><code>&lt;asp:HyperLink runat="server" Text="link1" NavigateUrl="~/default.aspx" /&gt; | 
  &lt;asp:HyperLink runat="server" Text="LINK2" NavigateUrl="~/Secure/RACs/default.aspx" /&gt; | 
  &lt;asp:HyperLink runat="server" Text="link3" NavigateUrl="~/Admin/page3.aspx" /&gt; | 
  &lt;asp:HyperLink runat="server" Text="link4" NavigateUrl="~/Admin/page4.aspx" /&gt; | 
  &lt;asp:HyperLink runat="server" Text="link5" NavigateUrl="~/Admin/page5.aspx" /&gt; | 
  &lt;asp:HyperLink runat="server" Text="link6" NavigateUrl="~/Admin/page6.aspx" /&gt; | 
  &lt;asp:HyperLink runat="server" Text="link7" NavigateUrl="~/Admin/page7.aspx" /&gt; 
  </code></pre>
  
  <p>As you can see, everry link gets it's URL through "~", and every single one gets the :81 port number after the IP, but link 2 just doesn't keep any port number (if you click on it, it loses the port number, then if you add it back in the navigation bar in the browser, it works, but then and click anything inside it that leads to any other page within the same folder, the same problem occurs)</p>
  
  <p>Then I went to check and compare the headers and masterpage loadins, there doesn't seem to be anything that would affect port number. Codes follow:</p>
  
  <p>The LINK2 leads to:  </p>
  
  <pre><code>&lt;%@ Page Language="VB" MasterPageFile="~/Common/MasterPage.master" Title="LINK2" Culture="pt-BR" UICulture="pt-BR" %&gt;
  &lt;%@ Register TagPrefix="uct" TagName="RacControl" Src="~/Secure/RACs/RACControl.ascx" %&gt;
  &lt;%@ Register TagPrefix="uct" TagName="DOCsControl" Src="DOCsControl.ascx" %&gt;
  &lt;%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %&gt;
  &lt;%@ Import Namespace="Pm.Common.Type" %&gt;
  </code></pre>
  
  <p>And (for example) link 3 leads to:  </p>
  
  <pre><code>&lt;%@ Page Language="VB" MasterPageFile="~/Common/MasterPage.master" Title="LINK3" %&gt;
  &lt;%@ Register TagPrefix="uct" TagName="link3" Src="~/Admin/UsersControl.ascx" %&gt;
  &lt;%@ Register TagPrefix="uct" TagName="CreateUserControl" Src="~/Admin/CreateUserControl.ascx" %&gt;
  </code></pre>
  
  <p>Where would be any issue that would cause the page to lose the port number everytime I want to access anything on the "/secure/racs" folder ? </p>
  
  <p>I'll be watching this question, please comment, anything will help, and I'll post more code if requested.</p>
  
  <p>--[EDIT 1]--
  Running fiddler, and clicking in one link (the main one) that loses port when clicked, I get this redirection:</p>
  
  <p><a href="http://dl.dropbox.com/u/3045472/losingport.png" rel="nofollow noreferrer">alt text http://dl.dropbox.com/u/3045472/losingport.png</a></p>
  
  <p>A good thing is that the problem isn't in the request, a bad thing is that I don't know what is redirecting it to the default port while not redirecting the rest of the pages.</p>