Why does ASP.Net rewrite relative paths for runat=server anchor controls?

Posted by Atomiton on Stack Overflow See other posts from Stack Overflow or by Atomiton
Published on 2010-03-24T15:20:57Z Indexed on 2010/03/24 16:03 UTC
Read the original article Hit count: 265

Filed under:
|
|
|

I have my UserControls in a ~/Controls folder in my solution:

/Controls/TheControl.ascx

If specify the following:

<a runat="server" href="./?pg=1">link text</a>

ASP.Net seems to want to rewrite the path to point to the absolute location. For example, If the control is on site.com/products/fish/cans.aspx the link href will be rewritten to read

<a href="../../Controls/?pg=1>link text</a>

Why does Asp.Net rewrite these control paths, and is there an elegant way to fix it?

I just want the anchor control to spit out exactly what I tell it to!!! Is that so hard?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about relative-path