ASP.NET配置使用层次式配置体系结构。ASP.NET的所有配置信息都包含了在配置文件中,该文件为config.web,它位于与应用程序文件相同的目录中。除非子目录内的config.web文件覆盖了父目录的设置,否则,子目录降继承父目录的设置。 config.web文件为每种主要的ASP.NET功能提供了对应部分。 config.web文件中有关安全的内容如下所示: <security> <authentication mode=”[windows/cookie/passport/none]”> <cookie cookie=”[name]” loginurl=”[url]” decryptionkey=”[key]”> <credentials passwordformat =”[clear,shal,md5]”> <user name=”[username]”password=”[password]”/> </credentials> </cookie> <passport redirecturl=”internal”/> </authentication> <authorization> <allow users=”[comma separated list of users]” roles=”[comma separated list of roles]”/> <deny users=”[comma separated list of users]” roles=”[comma separated list of roles]”/> </authentication> <identity> <impersonation enable =”[true/false]”/> </identity> </security> 这部分主要分为三部分: »认证 »授权 »身份 通过应用程序根目录的应用程序配置文件中类似的一部分来覆盖计算机层次配置文件中的对应部分,就可以设置每个要素的值。所有子目录降自动继承设置,然而,子目录也可以通过覆盖其父目录的设置来拥有自己的配置文件。
|