KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Asp.Net is awfully clever and tries to resolve the NavigateUrl of a Hyperlink relative to the control it is in or relative to the application root if you put ~/ at the start. But I have a situation where I want to explicitly set the url to a relative path and I don't want it to 'help' me at all. Hyperlink's navigate url and HtmlAnchor's href property both exhibit this behaviour. Is it possible to stop this behaviour - or will I have to generate the markup by hand and not use a control? e.g. I have a user control in folder [appRoot]/foo/bar that contains asp:Hyperlinks . I am using the control in the page [appRoot]/myPage.aspx . I want the href property of the hyperlinks, when rendered, to be exactly equal to 'donkey.gif' . But if I write the following <asp:Hyperlink runat="server" NavigateUrl="donkey.gif" /> then the rendered href will be 'foo/bar/donkey.gif' . For complicated reasons that I would rather not go into here, using "~/donkey.gif" is not an option. Also, I cannot use ResolveUrl(string url) to generate an absolute urls.
Tags (comma-separated)
Save Edits
Cancel