Asp.Net MVC Core 1.0 - Binding Tag Helper with Empty Area

I have an area called Admin, on one of my pages in this area, I want to go to views located outside my area, in fact it is not in any area, using HTML helpers that I could go empty for this like this:

@Html.ActionLink(item.ArticleTitle, "Details", new { id = item.ArticleId,title=item.ArticleTitle.Replace(' ', '-'), Area = "" }) 

But when using the tag helper, passing empty does not work:

 <a asp-action="Details" asp-route-area="" asp-route-id="@item.ArticleId" asp-route-title="@item.ArticleTitle.Replace(' ', '-')" class="btn btn-default">Detail</a> 

It is worth noting that I have already seen this question , but my question specifically refers to the area so that it takes me to the root of the site, outside the current area, and I know that I can use a regular URL, but I was curious can this be done using helper tags.

+1
source share
1 answer

With ASP.NET RC2, it must work to use asp-area="" . And I'm sure that with RC1, I returned outside the region without even specifying the region.

See my post on GitHub: https://github.com/aspnet/Mvc/issues/4319

Edit

From my github post:

With RC1, the following link was displayed as a link to the root, even within the scope:

 <a asp-controller="Home" asp-action="Index">Home</a> 

With RC2 (I had a nightly build 1.0.0-rc2-20270) such links that were displayed relative to the area. This worked for me:

 <a asp-controller="Home" asp-action="Index" asp-area="">Home</a> 
+2
source

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


All Articles