问题描述
我想使用的位置路径,允许用户和拒绝用户限制我的MVC应用程序的访问。这是我添加到web.config
I want to use the location path , allow user and deny user to restrict access in my MVC app. This is the section that I added to the web.config
<location path="Views/Admin/Ticketing/Seasons.aspx">
<system.web>
<authorization>
<allow users="admin" />
<deny users="user1" />
</authorization>
</system.web>
</location>
这是行不通的。非管理员用户,比如用户1仍然可以查看页面。我不知道这是否是因为我有路由设置不同的或者错误的。
It is not working. non-admin users, like user1 can still view the page. I am not sure if it is because I have the routing set up differently or wrong.
这是我想阻止标签的网址
This is the URL of the tab I want to block
这是在磁盘上的页面的物理路径
D:\\ dev的\\ MarilynDenisServices的\\ src \\网络\\视图\\管理\\售票\\ Seasons.aspx
This is the physical path of this page on diskD:\dev\MarilynDenisServices\src\Web\Views\Admin\Ticketing\Seasons.aspx
这就是我如何配置它的视图模型
And this is how I configured it on the view model
<div id="menucontainer">
<ul id="menu">
<li><%= Html.ActionLink("Ticketing", "TicketingSeasons", "Admin") %></li>
</ul>
</div>
这是我的行动
public ActionResult TicketingSeasons()
{
return View("Ticketing/Seasons");
}
谁能告诉我什么,我做错了什么?
Can someone tell me what I am doing wrong?
推荐答案
试试这个位置路径:
<location path="Admin/TicketingSeasons">
<system.web>
<authorization>
<allow users="admin" />
<deny users="user1" />
</authorization>
</system.web>
</location>
这篇关于与MVC应用程序中使用位置路径不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!