Last post Apr 01, 2012 04:24 PM by mm10
Apr 01, 2012 11:52 AM|martincapon|LINK
I want to get access to the variable maxRequestLength in web.config, but don't know how. Also I want to write this variable wirh another amount.
I read about getsection from configurationmanager, but don't know any example.
Thanks in advance if you can help me.
Apr 01, 2012 01:16 PM|AmalO.Abdullah|LINK
check out this it may help you
Apr 01, 2012 04:19 PM|martincapon|LINK
Thanks for the reply. Now the problem is that I have not referenced the system.web.configuration, so I can't use httpruntimesection.
Where can I find the system..web.configuration namespace?
Again, thanks a lot
Apr 01, 2012 04:24 PM|mm10|LINK
You can set in your web.config file anywhere inside<system.web>:
<!-- Other contents goes here -->
...and to access it programmatically;
HttpRuntimeSection section = ConfigurationManager.GetSection("system.web/httpRuntime") as HttpRuntimeSection;
section.MaxRequestLength = 10000;