Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Apr 01, 2012 04:24 PM by mm10
Member
46 Points
103 Posts
Apr 01, 2012 11:52 AM|LINK
Hi all:
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.
Contributor
3116 Points
764 Posts
Apr 01, 2012 01:16 PM|LINK
hi ,,
check out this it may help you
http://msdn.microsoft.com/en-us/library/system.web.configuration.httpruntimesection.maxrequestlength.aspx
Apr 01, 2012 04:19 PM|LINK
Hi again:
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
6439 Points
1184 Posts
Apr 01, 2012 04:24 PM|LINK
You can set in your web.config file anywhere inside<system.web>:
<?xml version="1.0"?> <configuration> <system.web> <httpRuntime maxRequestLength="1048576" executionTimeout="3600" /> <!-- Other contents goes here --> </system.web> </configuration>
...and to access it programmatically;
using System.Web.Configuration; .... HttpRuntimeSection section = ConfigurationManager.GetSection("system.web/httpRuntime") as HttpRuntimeSection; section.MaxRequestLength = 10000;
martincapon
Member
46 Points
103 Posts
Get access to maxRequestLength in web.config
Apr 01, 2012 11:52 AM|LINK
Hi all:
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.
AmalO.Abdull...
Contributor
3116 Points
764 Posts
Re: Get access to maxRequestLength in web.config
Apr 01, 2012 01:16 PM|LINK
hi ,,
check out this it may help you
http://msdn.microsoft.com/en-us/library/system.web.configuration.httpruntimesection.maxrequestlength.aspx
martincapon
Member
46 Points
103 Posts
Re: Get access to maxRequestLength in web.config
Apr 01, 2012 04:19 PM|LINK
Hi again:
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
mm10
Contributor
6439 Points
1184 Posts
Re: Get access to maxRequestLength in web.config
Apr 01, 2012 04:24 PM|LINK
You can set in your web.config file anywhere inside<system.web>:
<?xml version="1.0"?> <configuration> <system.web> <httpRuntime maxRequestLength="1048576" executionTimeout="3600" /> <!-- Other contents goes here --> </system.web> </configuration>...and to access it programmatically;
using System.Web.Configuration; .... HttpRuntimeSection section = ConfigurationManager.GetSection("system.web/httpRuntime") as HttpRuntimeSection; section.MaxRequestLength = 10000;