turning off viewstate didn't work in web.config

D

DC Gringo

I want to turn off viewstate for an application. I added the code below
into my web.config, but I'm still getting lotsa viewstate data in my hidden
form field:

<configuration>
<appSettings>
<Pages EnableViewState="false" />
</appSettings>

.....
</configuration>
 
S

Scott Mitchell [MVP]

Off the top of my head, I believe the <pages> (case is important)
setting goes in the <system.web> section, and *not* in the <appSettings>
section.

FYI, even when you turn off view state on all pages, you will still get
*some* (albeit, very little). For more on why, see:
http://scottonwriting.net/sowblog/posts/1608.aspx



DC said:
I want to turn off viewstate for an application. I added the code below
into my web.config, but I'm still getting lotsa viewstate data in my hidden
form field:

<configuration>
<appSettings>
<Pages EnableViewState="false" />
</appSettings>

....
</configuration>


--

Scott Mitchell
(e-mail address removed)
http://www.4GuysFromRolla.com

* When you think ASP.NET, think 4GuysFromRolla.com!
 
D

DC Gringo

Thank you. The problems turned out to be the "enableViewState" had an
erroneous capital "E" as well as an extra appsettings key...

I copied this straight out of the VS.NET help which has the capital E:

Disabling ViewState

In the example above, I disabled ViewState for the grid by setting its
EnableViewState property to false. ViewState can be disabled for a single
control, for an entire page, or for an entire application, as follows:

Per control (on tag)<asp:datagrid EnableViewState="false" . />
Per page (in directive)<%@ Page EnableViewState="False" . %>
Per application (in web.config)<Pages EnableViewState="false" . />


_____
DC G
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top