How to access httpRuntime section of web.config from codebehind?

后端 未结 2 1772
攒了一身酷
攒了一身酷 2020-12-31 13:33

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 w

2条回答
  •  别那么骄傲
    2020-12-31 14:07

    You can try something like

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

    you can then get section.MaxRequestLength

提交回复
热议问题