Update
RouteData.Values["id"] + Request.Url.Query
Will match all your examples
It is not clear what you are trying to achieve. MVC passes you URLs through model binding.
public class CustomerController : Controller { public ActionResult Edit(int id) { int customerId = id
Adding route mapping to the global.asax.cs file before the / administration / part element is processed by default. Or you can look in the field of MVC.
routes.MapRoute( "Admin", // Route name "Administration/{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
If this is raw URL data after that, you can use one of the various URL and query properties available in your controller action.
string url = Request.RawUrl; string query= Request.Url.Query; string isAllowed= Request.QueryString["allowed"];
It looks like Request.Url.PathAndQuery might be what you want.
If you need access to the source data, you can use
string isAllowed = Request.Params["allowed"]; string id = RouteData.Values["id"];
David Glenn Feb 15 2018-11-15T00: 00Z
source share