2011-02-28 100 views
3

我環顧四周,還沒有找到一種方法來在文件大小的配置部分和我允許的最大值之間進行同步。它甚至有可能嗎?以編程方式訪問httpRuntime maxRequestLength

在web.config文件中允許非常大的文件大小,然後在您的實現中實施更小的大小是否是最佳實踐?

+2

答案就在這裏:http://stackoverflow.com/questions/4887016/how-to-access-httpruntime-section-的 - 網絡配置 - 從 - 代碼隱藏 – 2011-08-18 21:51:02

回答

1

嘗試這樣:

HttpRuntimeSection section = ConfigurationManager.GetSection("system.web/httpRuntime") as HttpRuntimeSection; 

,那麼你得到section.MaxRequestLength