问题描述
在我的 ASP.NET 的 Web 配置文件中,我定义了以下位置元素:
In my ASP.NET's Web Config file I have the following location elements defined:
<location path="">
<system.web>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
</location>
<location path="dir1">
<system.web>
<authorization>
<allow users="?"/>
</authorization>
</system.web>
</location>
<location path="dir2">
<system.web>
<authorization>
<allow users="?"/>
</authorization>
</system.web>
</location>
上面的例子指定了除了两个目录 dir1 和 dir2 之外的所有目录都将被锁定给匿名用户.
The example above is specifying that all directories will be locked down to anonymous users except the two directories dir1 and dir2.
我很好奇是否有一种语法可以让我在一个位置元素中定义多个目录.例如,如果我们能做这样的事情就很方便了...
I'm curious if there is a syntax that I can use that will allow me to define more than one directory within one location element. For example, it would be convenient if we could do something like this...
<location path="dir1,dir2,etc">
<system.web>
<authorization>
<allow users="?"/>
</authorization>
</system.web>
</location>
推荐答案
抱歉,路径属性不允许使用,"所以你必须为所有路径写标签,或者您可以在每个目录中创建 web.config.
sorry, but path property doesn't allow to use ","so you must write tag for all path,Or you can create web.config in each directory.
这篇关于在 Web.Config 的位置路径元素中指定多个目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!