将<location>
标记添加到web.config(ASP.NET 4)后,我得到了HTTP 500 Internal Server Error
,当我删除<location>
时,它就可以了。
<?xml version="1.0"?>
<configuration>
<location path="man">
<system.web>
<authorization>
<allow users="man"/>
<deny users="*"/>
</authorization>
</system.web>
</location>
<configSections>
<section name="rewriter"
requirePermission="false"
type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter" />
</configSections>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<authentication mode="Forms">
<forms name=".ASPXAUTH"
loginUrl="Login.aspx"
protection="All"
timeout="30"
path="/"
requireSSL="false"
slidingExpiration="true"
defaultUrl="Login.aspx"
cookieless="UseCookies"
enableCrossAppRedirects="false"/>
</authentication>
<httpModules>
<add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter" />
</httpModules>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule" />
</modules>
<validation validateIntegratedModeConfiguration="false" />
</system.webServer>
<rewriter>
<rewrite url="~/man/(.+)" to="~/man/$1" processing="stop" />
<rewrite url="~/man/^(/.+(\.gif|\.png|\.jpg|\.ico|\.pdf|\.css|\.js|\.axd)(\?.+)?)$" to="~/man/$1" processing="stop" />
<rewrite url="~/files/^(/.+(\.gif|\.png|\.jpg|\.ico|\.pdf|\.css|\.js|\.axd|\.pdf|\.doc|\.ppt)(\?.+)?)$" to="~/files/$1" processing="stop" />
<rewrite url="~/man/" to="~/man/default.aspx" processing="stop"/>
<rewrite url="~/style/(.+)" to="~/style/$1" processing="stop" />
<rewrite url="~/images/(.+)" to="~/images/$1" processing="stop" />
<rewrite url="^(/.+(\.gif|\.png|\.jpg|\.ico|\.pdf|\.css|\.js|\.axd)(\?.+)?)$" to="$1" processing="stop" />
<rewrite url="~/(.+)" to="~/default.aspx?pn=$1" />
</rewriter>
</configuration>
答案 0 :(得分:3)
位置必须低于configSections