首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

求教MVC3中authentication有关问题

2012-09-06 
求教MVC3中authentication问题最近项目中需要对权限进行认证,在web.config文件中加入了以下内容authentic

求教MVC3中authentication问题
最近项目中需要对权限进行认证,在web.config文件中加入了以下内容
<authentication mode="Forms">
  <forms loginUrl="~/Account/Logon" timeout="2880"/>
</authentication>
<authorization>
  <deny users="?"/>
</authorization>
<location path ="LoadPage">
  <system.web>
  <authorization>
  <allow users="?"/>
  </authorization>
  </system.web>
</location>

同时Global.asax中增加了一条路由规则:
routes.MapRoute(
  "Default", // Route name
  "{controller}/{action}/{id}", // URL with parameters
  new { controller = "LoadPage", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);

问题在于,在URL中拼写:http://127.0.0.1:81/LoadPage/Index 可以正常访问
但是http://127.0.0.1:81/ 无法正常访问

不知该如何解决,望高手指点

[解决办法]
你那样写当然不能访问了,你这还差一层呢,你应该这样写(http://127.0.0.1:81/LoadPage )!要http://127.0.0.1:81/这样访问,你主页index,应该与LoadPage放在同目录下!

热点排行