以编程方式访问httpRuntime maxRequestLength

时间:2011-02-28 23:47:04

标签: asp.net file-upload

我环顾四周,还找到了在配置部分之间同步文件大小和我允许的最大值的方法。它甚至可能吗?

最佳做法是在web.config文件中允许非常大的文件大小,然后在实现中强制实施更小的文件吗?

1 个答案:

答案 0 :(得分:1)

尝试这样的事情:

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

那么你得到section.MaxRequestLength