Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set aspnet:MaxHttpCollectionKeys Programmatically

In a bit of admin functionality for a particular site, I'm doing a particularly horrific post that necessitates a large amount of data to be posted. In order to make that happen, I had to add the Web.config appSetting:

<add key="aspnet:MaxHttpCollectionKeys" value="2000" />

However, I only want this large post to be possible under a particular set of circumstances. Is there any way to programmatically set this value?

like image 772
eouw0o83hf Avatar asked May 24 '12 19:05

eouw0o83hf


2 Answers

Looks like it's not possible, per this answer:

https://stackoverflow.com/a/10753846/570190

"You cannot override this because the reading of the setting and the default value is done inside an internal class."

like image 28
eouw0o83hf Avatar answered Nov 07 '22 08:11

eouw0o83hf


You could make the setting specific to a location by placing the appSetting under a location tag in your web.config.

http://msdn.microsoft.com/en-us/library/b6x6shw7.aspx

like image 177
spender Avatar answered Nov 07 '22 07:11

spender