我希望有一个控制器/动作,这样当我导航到:
mysite.com/whatever. i type here will pipe into...a ! string.
public ActionResult Index(string anything)
{
// anything = whatever. i type here will pipe into...a ! string.
return View();
}
我需要设置自定义路由吗?
我已经尝试过这个方法,但好像不能处理句号等符号。
routes.MapRoute(
name: "Default",
url: "{*anything}",
defaults: new { controller = "Home", action = "Index" }
);