routes.MapRoute("Archive.CityState",
"Archive/{City}/{State}/{OP1}/{OP2}",
new { controller = "Archive", action = "CityState", OP1 = UrlParameter.Optional, OP2 = UrlParameter.Optional },
new { City="[a-zA-Z]+" ,State = @"[a-zA-Z]{2}", OP1 = @"[a-zA-Z]+" , OP2 =@"\d{4}" });
public ActionResult CityState(string City, string State, string OP1, int OP2)
{
var x = City;
var y = State;
var OptionalParameter1= OP1;
var OptionalParameter2 = OP2;
return View();
}
This can map
Archive/Remond/WA/Chemistry
Archive/Remond/WA/Chemistry/2010
But not
Archive/Remond/WA
Can anyone help? Thanks.