Solved

Disabling ViewState

Posted on 2013-01-10
6
230 Views
Last Modified: 2013-01-17
I'm trying to disable ViewState - I've tried putting enableViewState="false" in web.config, in the page heading and in Page_Init and it still appears.

Not only does the page source contain it, but the controls continue to keep their old values. Text boxes retain their data, drop down lists retain the selected index after clicking a button that runs code on the server.

The only way I have found to genuinely stop this was to add Javascript to the page to remove __VIEWSTATE.

Is there a way to actually stop it working without the javascript?

I've attached my VS solution.
0
Comment
Question by:purplesoup
6 Comments
 
LVL 20

Expert Comment

by:informaniac
ID: 38762536
What about the masterpage?
0
 
LVL 39

Expert Comment

by:Pratima Pharande
ID: 38762552
0
 

Author Comment

by:purplesoup
ID: 38762726
informaniac - exactly - what about it - the example doesn't have one.

pratima_mcs - I'm sure you didn't just send me a link to something that looked vaguely similar to my question without checking that it did actually solve my problem, so exactly which bit of that answer do you think I'm missing?
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 74

Expert Comment

by:käµfm³d 👽
ID: 38762772
Did you intend to attach something?
0
 
LVL 20

Accepted Solution

by:
informaniac earned 500 total points
ID: 38763042
The textbox behavior is by design. It will retain it's value even if ViewState is disabled.(I just learned this today, when someone asked me this in an interview).

This link supports the behavior.
http://support.microsoft.com/?id=316813
0
 

Author Comment

by:purplesoup
ID: 38763661
ok I thought I'd attached my example and somehow it didn't attach... sorry :(

Well I want a simple example that shows ViewState not working so I can try alternatives to it - for example using ControlState.

Hopefully example now attached...
ControlStateExample.zip
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now