我需要的链接是这样的格式http://localhost:32136/username/HomePage
例如:-https://www.facebook.com/xxxyyyy
请建议我的链接如何建设的网址.I已配置的route.config为
routes.MapRoute(
name: "Profile",
url: "{username}",
defaults: new { controller = "Account", action = "Profile" },
constraints: new { username = "Vinoth" }
);发布于 2015-09-04 15:26:09
试试这个。
RouteConfig.cs
routes.MapRoute(
name: "ProfileRoute",
url: "{username}/{action}",
defaults: new { controller = "Account", action = "Profile" },
);AccountController.cs
public ActionResult Profile(string username)
{
if(username != "Vinoth")
return HttpNotFound();
return View(username);
}https://stackoverflow.com/questions/32391507
复制相似问题