Url.Content in asp.net web-forms

Omu picture Omu · Jun 13, 2011 · Viewed 20k times · Source

I'm trying to do this:

<a href="~/Cases/SupRequestSearch.aspx">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 ?

Answer

Ben Cull picture Ben Cull · Jun 25, 2012

As rapadai mentioned above, the equivalent of

Url.Content("~/path/to/file.ext") // MVC

in webforms is

Page.ResolveUrl("~/path/to/file.ext") // Webforms