第Web.Config中特定配置 [英] Page Specific Configuration in Web.Config

查看:186
本文介绍了第Web.Config中特定配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道是否有设置基于页面的配置在web.config中的一种方式?可以说我有 Default.aspx的 Product.aspx 我要定义不同的配置,如的EnableViewState 等,但在的web.config ,而不是本身的页面。

I do wonder whether there is a way to set page-based configuration in web.config? Lets say I have Default.aspx and Product.aspx and I want to define different configurations such as EnableViewState etc. but in web.config rather than in page itself.

所以,你可能会问,为什么?请不要理解这是应该的。

So you may ask why? Please do understand this is how it should be.

推荐答案

您可以使用的地点在web.config中标记为不同的路径指定不同的设置。

You can use the location tag in web.config to specify different settings for different paths.

<configuration>
   <location path="Logon.aspx">
      <system.web>
         <authorization>
            <allow users="?"/>
         </authorization>
      </system.web>
   </location>

   <location path="UploadPage.aspx">
     <system.web>
       <httpRuntime maxRequestLength="128"/>
    </system.web>
  </location>
</configuration>

这篇关于第Web.Config中特定配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆