Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QueryString with ASP.NET MVC 6 Anchor Tag Helper

I need to create the following html output:

<a href="account/register?provider=1">Register</a>

How can I accomplish this with ASP.NET MVC 6 anchor tag helper? It seems that there is no option for the query string part. I want to use

<a asp-action="Register" asp-controller="Account">Register</a>

but where do I put "provider=1"?

like image 378
Wheel Builder Avatar asked May 06 '16 13:05

Wheel Builder


1 Answers

Did you try the asp-route-* attribute:

<a asp-action="Register" 
   asp-controller="Account"
   asp-route-provider="1">
    Register
</a>
like image 138
Darin Dimitrov Avatar answered Oct 19 '22 16:10

Darin Dimitrov