是这样有一个新增的<httpModules>节放到程序根目录web.config中是有效的可用,但这不符合我的要求,我只要其中一个目录下文件有效,我新建一个web.config以下文件,放到一个目录下,并将程序根目录web.config中<httpModules>节注释了。但这样无法可用,请问错在哪里。
web.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.web>
     <httpModules>
         <add name="HttpUploadModule" 
                    type="Krystalware.SlickUpload.HttpUploadModule, Krystalware.SlickUpload" />
      </httpModules>
 </system.web>
</configuration>

解决方案 »

  1.   

    象认证或httpModule这样的东西,只适合于整个应用,所以只能在你的应用的根目录
    里,参考http://winfx.msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_aspnetconfig/html/c282a0c3-0642-458b-8426-565ead922749.aspNot valid in application child directories   Because they apply to an entire application, the authentication, httpModules, sessionState, and trust configuration elements are excluded from child directories of applications. That is, they are restricted to the Machine.config file and to the Web.config file at the Web site and the application levels only. You can use the allowDefinition attribute to restrict a configuration section to the Web.config file.
    建议你在web.config加一个setting设置你需要处理的目录,在你的httpModule检查这个setting,然后跟当前请求的URL做比较,如果符合条件就处理,否则不处理
      

  2.   

    </system.web>
    <!-- 使用location-->
    <location path="admin">
    <system.web>
    <authorization>
    <deny users="?" />
    </authorization>
    <!--<sessionState mode="Off" 
    cookieless="true"  />-->
    </system.web>
    </location>
    </configuration>
      

  3.   

    setting设置怎么设置啊,有例子看看吗
      

  4.   

    http://chs.gotdotnet.com/quickstart/aspplus/doc/configformat.aspx
    看了明白了
      

  5.   

    已经说了,不可能通过web.config来设置,需要通过在程序里自己处理,譬如你的HttpModule可以读取web.config以下的设置来恰当地处理<configuration>
      <!-- application specific settings -->  <appSettings>
          <add key="FoldersToApply" value="dir1,dir2,dir3" />
      </appSettings>  <system.web>
         ...
      </system.web>
    </configuration>