enableviewstate override not working in web.config

M

Max Metral

I have a Web.config in my application root dir with the following pages
directive:

<pages buffer="true"
enableViewState="false" enableSessionState="false"
enableViewStateMac="false"/>

And then one in a subdirectory with this one (viewstate enabled):

<pages buffer="true"
enableViewState="true" enableSessionState="false"
enableViewStateMac="true"/>

View state does NOT get enabled in the subdirectory. If I change the pages
directive in the root dir, ViewState goes on. Otherwise, it doesn't. I
can't imagine how this isn't a bug... Any ideas?

As a possible aside, the page in the subdir uses a control, that is also in
the subdir. I put a check in the controls Page_Load of the control to check
ViewState. It thinks it's on.

if (Page.EnableViewState == false || this.EnableViewState == false)
{
Response.Write("Cannot run without view state");
Response.End();
}


Thanks
--max
 
S

Steven Cheng[MSFT]

Hi Max,

As for the problem( <pages enableViewState="true|false" /> can't be
override via web.config in sub dir), I've also done some tests on my side
and did encounter the same problem. And currently I'm consulting some
further experts to confirm whether this is a known issue of the asp.net
configuration and will give a update soon. Also, I think as for such
problem on specifying a override configure schema for asp.net sub dir , we
can use the <location> element in the root web.config file instead of
puting a separate one in sub dir. Here are some reference on applying the
<locaiton> elemtn to implement hierarchy configuration in asp.net app:

#<location> Element
http://msdn.microsoft.com/library/en-us/cpgenref/html/gngrfLocationElement.a
sp?frame=true

#Configuration <location> Settings
http://msdn.microsoft.com/library/en-us/cpguide/html/cpconconfigurationlocat
ionsettings.asp?frame=true

Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 
M

Max Metral

Thanks for the reply. It looks as if doing it in a location directive
doesn't work either. Same behavior, it says it's working (the page thinks
viewstate is on), but it's all a big lie. :)

--Max
 
S

Steven Cheng[MSFT]

Hi Max,

It seems a bit strange, I've try set the sub dir ( in IIS manage console )
as an application and then set it back to a normal dir and restart the IIS
server, after that , all is working well. The web.config in the sub dir's
setting can override the root web.config file's setting. Would you please
also have a try on this.
You can make the sub dir as an application virutal dir and test again.
Then, reset it back to a normal dir and test to see whether this helps.
Currently on my side, the enableViewState override works well.
If you have any new findings or question, please feel free to post here.
Thanks.


Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 
M

Max Metral

My not-so-fun-but-no-so-hard solution was just to mark enableviewstate=false
everywhere, in all controls and pages, and the remove it from web.config.
Then I can turn it on selectively.
 
S

Steven Cheng[MSFT]

Hi Max,

You mean the setting in sub folder's web.config file still not working on
your side? Have you tried the means mentioned in my last reply? Or you can
try this on another machine to see whether it work. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 

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,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top