c# - Match Route Only if specific Parameter -
i trying create route matches if specific parameter used in url.
for example:
routes.maproute( name: "bannerads", url: "go/{web}", defaults: new { controller = "communicationsalias", action = "bannerads", web = urlparameter.optional } );
i want url match http://www.domain.com/go/web?=111222
but not http://www.domain.com/go/advertising
how change route function way?
you need make part of url static in route then:
routes.maproute( name: "bannerads", url: "go/web", defaults: new { controller = "communicationsalias", action = "bannerads" } );
and place route above more general one:
routes.maproute( name: "bannerads", url: "go/{web}", defaults: new { controller = "communicationsalias", action = "bannerads", web = urlparameter.optional } );
Comments
Post a Comment