I want to change maxRequestLength but I want to set this in the asp.net page progammatically only for this page, i do NOT want to set this value in the web.config file.
does anyone know how to just set this in the asp.net page?
I want to change maxRequestLength but I want to set this in the asp.net page progammatically only for this page, i do NOT want to set this value in the web.config file.
I believe you can't set maxRequestLength property at page level.
MyronCope
does anyone know how to just set this in the asp.net page?
You can use "location path" for
settings to a specific file in Webconfig..
you may use localized web.config. web.config for subdirectories to control the settings for pages under that directory. Hope you understand the configuration file hierarchy.
Global Machine->Root Default Web->Web Site->Web App->Sub Directory.
I think this is the best solution for you.
i havent used the location tag, but i have used a seperate web.config located in a subfolder to control that specific subfolder (which contained my upload page)
if you create an additional web.config like this in the ~/assessment/LAR subfolder, then your changes are localized to that subfolder and below.
MyronCope
Participant
1656 Points
1345 Posts
set MaxRequestLength programmatically
Jan 17, 2011 05:35 PM|LINK
using vb.net/asp.net 2005.
I want to change maxRequestLength but I want to set this in the asp.net page progammatically only for this page, i do NOT want to set this value in the web.config file.
does anyone know how to just set this in the asp.net page?
thanks
MC
herich6
Member
82 Points
23 Posts
Re: set MaxRequestLength programmatically
Jan 17, 2011 05:55 PM|LINK
<div style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">
System.Web.Configuration<div style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: black; "></div><div style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: black; "></div></div><div style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: black; "></div>' Set the MaxRequestLength property value to 2048 kilobytes. configSection.MaxRequestLength = 2048Please mark the answer if it helped you
budugu
All-Star
41132 Points
6021 Posts
Re: set MaxRequestLength programmatically
Jan 17, 2011 05:56 PM|LINK
I believe you can't set maxRequestLength property at page level.
You can use "location path" for settings to a specific file in Webconfig..
<configuration> <location path="YourPage.aspx"> <system.web> <httpRuntime maxRequestLength="1028576" /> </system.web> </location> </configuration>"Don't be afraid to be wrong; otherwise you'll never be right."
Shuvo Aymon
Contributor
4820 Points
1167 Posts
Re: set MaxRequestLength programmatically
Jan 17, 2011 06:06 PM|LINK
not yet got the proper answer
you may check:
http://msdn.microsoft.com/en-us/library/ydy4x04a(VS.71).aspx
If more posts give you useful answers, Please mark each post as "Answer".
Shuvo Aymon
Contributor
4820 Points
1167 Posts
Re: set MaxRequestLength programmatically
Jan 17, 2011 06:22 PM|LINK
you may use localized web.config. web.config for subdirectories to control the settings for pages under that directory. Hope you understand the configuration file hierarchy. Global Machine->Root Default Web->Web Site->Web App->Sub Directory.
I think this is the best solution for you.
i havent used the location tag, but i have used a seperate web.config located in a subfolder to control that specific subfolder (which contained my upload page)
if you create an additional web.config like this in the ~/assessment/LAR subfolder, then your changes are localized to that subfolder and below.
<?xml version="1.0" encoding="utf-8" ?> <configuration> <system.web> <httpRuntime maxRequestLength="2048576" executionTimeout="54000" /> </system.web> </configuration>Then to localize the folder settings to a specific file,this should work (but i have no way to test this for you right now)
If more posts give you useful answers, Please mark each post as "Answer".