问题描述
我尝试使用
[Route("User/ChangePassword")
public ActionResult ChangePassword()
但是它不起作用!
RouteConfig
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapMvcAttributeRoutes();
routes.MapRoute(
name: "Default",url: "{controller}/{action}/{id}",defaults: new { controller = "Home",action = "Index",id = UrlParameter.Optional }
);
}
UserAreaRegistration
public override string AreaName
{
get
{
return "User";
}
}
public override void Registerarea(AreaRegistrationContext context)
{
context.MapRoute(
"User_default","User/{controller}/{action}/{id}",new { action = "Index",id = UrlParameter.Optional }
);
}
domain.com/user/changepassword
解决方法
您可以在Route.config中添加名称空间。它将指向该区域的配置路径
BluetoothAdapter myBTAdapter = BluetoothAdapter.getDefaultAdapter();
myBTAdapter.setName("new_name");