I am trying to follow the convention used by many sites that pass arguments with multiple slashes, as opposed to using the GET model.
That is, I am looking to use a URL, for example:
http:
In this way:
http://www.foo.bar/controller/action/a/b/c
I am currently working with this (mainly) using the following:
public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } ); routes.MapRoute( name: "Sandbox", url: "Sandbox/{action}/{*args}", defaults: new { controller = "Sandbox", action = "Index", args = UrlParameter.Optional } ); }
However, if I pass something like
http:
or
http:
The controller and action are called accordingly:
public ActionResult Index(string args) { return View(); }
but args is null.
However, if I pass something like:
http:
Then args is "a / b" if required.
I searched for SO and the rest of the Internet, but can't find a solution.
Is there something obvious that I'm missing to fix this behavior?
Am I looking for the wrong terminology?
Note. I was able to reproduce this problem with a new ASP.NET application using Windows Authentication. All that has been done:
Any help is greatly appreciated. Thanks! A similar question, but it doesn't help me: URLs with a slash in the parameter?