I'm trying to do this:
<a href="~/Cases/SupRequestSearch.asp开发者_高级运维x">Search request</a>
so I need the ~ to be rendered as http://myserver/app/...
in mvc I would do
<a href="<%=Url.Content("~/Cases/SupRequestSearch.aspx")%>>Search request</a>
is there something similar in asp.net web forms ?
As rapadai mentioned above, the equivalent of
Url.Content("~/path/to/file.ext") // MVC
in webforms is
Page.ResolveUrl("~/path/to/file.ext") // Webforms
Try adding runat="server" to your tag.
Try this:
<asp:hyperlink  id="Search" NavigateUrl="~/Cases/SupRequestSearch.aspx" runat="server" />
or just
<a href="~/Cases/SupRequestSearch.aspx" id="Search" runat="server">Search request</a>
If you don't have either Url or Page you can still use
VirtualPathUtility.ToAppRelative(string) or VirtualPathUtility.ToAbsolute(string)
You still need to be within a web context of course - or this doesn't make sense.
See also : ResolveUrl without an ASP.NET Page
<%= Page.ResolveUrl("~/Path/To/Page") %>
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论