... allow "Home" (not "/ Home"). After I rewro...">

ASP.NET ~ / does not allow "/"

My application paths ... <runat = "server" href = "~ / Home">

... allow "Home" (not "/ Home"). After I rewrote the URLs, "/ Blah / Blah", all the links "~ /" refer to rewriting: / Blah / Home

Is there any way to force the root "/"?

+3
source share
4 answers

Why don't you just write links relative to the root ('/') instead of '~ /', if you are not an application in the root of the domain, then the links '~ /' will allow the root of the application

+1
source

, , , "/", - <a> href "/Home", "~/Home"... , asp.net , App/VDir .

0

HTML, a, URL-

<a href="<%=ResolveUrl("~/Home")%>">...</a>

asp.net:

<asp:Hyperlink NavigateUrl="~/Home" runat="server" ID="HomeLink" Text="..." />

, URL, - .

<% %> asp.net, <%= %> , ResolveUrl.

0

~/ - , ResolveClientUrl.

To manage the hyperlink, it will automatically display correctly for you.

0
source

Source: https://habr.com/ru/post/1730676/


All Articles