如何从codebehind访问的web.config中的httpRuntime节?web、codebehind、httpRuntime、config

2023-09-08 09:04:05 作者:左岸

其实我需要在web.config中的的httpRuntime 部分的的maxRequestLength 值来检查postedfile的大小越大。什么是阅读的最佳方法是什么?

actually i need the maxRequestLength value of the httpRuntime section in web.config to check if a postedfile's size is greater. What's the best way to read it?

感谢你在前进。

推荐答案

您可以尝试像

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

那么你可以得到 section.MaxRequestLength