How to hide querystring parameter name from an URL generated with Html.ActionLink in ASP.NET MVC

 In View we are going to create link using Html helper :
@Html.ActionLink("Address", "ViewAddress", new { addressId = Guid.NewGuid() })
that will give us :


We want to hide query string addressId and have only :


The solution is to add new map route.

Open RouteConfig.cs file from App_Start folder and add new Map Route:

routes.MapRoute("ListingPreview", "Home/ViewAddress/{addressId}",
                    controller = "Home",
                    action = "ViewAddress",
                    addressId= UrlParameter.Optional


  1. Stainless Steel Magnets - titanium arts
    Ironing the Stainless Steel Magnets (4-Pack). Made in Germany. The Titanium Arts Stainless titanium flat iron Steel Magnets are an alloy made of steel in stainless steel


Post a Comment