473,666 Members | 2,075 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Viewstate wont turn off even after setting it to off !

Hi All,
I have a webpage.aspx and a webusercontrol. ascx with both of them
having viewstate turned off.

Then in my web user control I have got some code reading the request
stream:

Dim str As IO.Stream
Dim strLen As Integer
Dim strRead As Integer

str = Request.InputSt ream
strLen = Integer.Parse(s tr.Length.ToStr ing())
Dim strArr(strLen) As Byte
strRead = str.Read(strArr , 0, strLen)

System.Text.Enc oding.ASCII.Get String(strArr, 0,
strLen).Substri ng(iStartIndex)

when I put a break point on the last line I get the following output:
"__VIEWSTATE=dD wtNzkxMjYyODQ5O zs%2BRIdmzZpk4% 2FEHqMI3MlRLHut 43bA
%3D&asdf=on&asd f=Robert+Hormoz i&IncDisplayFor m1%3AbtnSubmit= Submit"

I don't want this viewstate string I need what the html code looks
like in plain html. Is there anyway to do that ? Why is viewstate
still on even after I turn it off?

Thanks!

Apr 26 '07 #1
1 1582
re:
!Why is viewstate still on even after I turn it off?

You will always have a relatively short string representing the page itself even if you
turn off the view state on each and every control, on the page, or in web.config.

Don't worry about the 20 or so bytes which remain after you've turned off viewstate.
They don't mean much.

For a detailed explanation, see :
http://aspnetresources.com/articles/ViewState.aspx

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
"robert112" <ro*******@tpg. com.auwrote in message
news:11******** **************@ r30g2000prh.goo glegroups.com.. .
Hi All,
I have a webpage.aspx and a webusercontrol. ascx with both of them
having viewstate turned off.

Then in my web user control I have got some code reading the request
stream:

Dim str As IO.Stream
Dim strLen As Integer
Dim strRead As Integer

str = Request.InputSt ream
strLen = Integer.Parse(s tr.Length.ToStr ing())
Dim strArr(strLen) As Byte
strRead = str.Read(strArr , 0, strLen)

System.Text.Enc oding.ASCII.Get String(strArr, 0,
strLen).Substri ng(iStartIndex)

when I put a break point on the last line I get the following output:
"__VIEWSTATE=dD wtNzkxMjYyODQ5O zs%2BRIdmzZpk4% 2FEHqMI3MlRLHut 43bA
%3D&asdf=on&asd f=Robert+Hormoz i&IncDisplayFor m1%3AbtnSubmit= Submit"

I don't want this viewstate string I need what the html code looks
like in plain html. Is there anyway to do that ? Why is viewstate
still on even after I turn it off?

Thanks!

Apr 26 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1820
by: Chris Thompson | last post by:
I have a page that uses a custom object I wrote to build a table. I also have a post back to the page to remove items from that table. When the page loads I can see the viewstate code on the source of the page is about 5 lines. When I post back to remove an item and rebuild the page it works. I view the source of the page and the viewstate code has doubled in size even though I have less data for it to hold. On the second post back I...
6
7004
by: Robin Bonin | last post by:
In my user contol I am creating a set of dropdownlists. Each list is created based on input from the other lists. The problem I am having is setting the selected index on the lists. If someone changes box1, I want to set the selected index in box2 = 0. When I do this, I dont get an error, but when the page loads, it still has the selected value and not 0. It seems that it is getting the selected value from the viewstate
10
2260
by: neo | last post by:
hi, I am studying ASP.NET and have few questions - 1) The session ID and values of controls is stored in VIEWSTATE variable. So now when we put EnableViewState="false" in Page directive and disable the session state in Web.Config the VIEWSTATE variable is still maintained and stores some values. Can anyone tell what those values are for, i.e what other info is stored in VIEWSTATE other than the session ID and the control values ?
2
1635
by: DC Gringo | last post by:
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> .....
7
2039
by: et | last post by:
I'm not sure I understand the use of the ViewState. Do I understand correctly that values of controls are automatically held in a hidden control called ViewState? If so, then why can't we get them, or how do we get that value? I always have to set the ViewState("FirstName") = txtBox.text myself before a postback is done, otherwise, the value of ViewState("FirstName") is always empty; there doesn't seem to be a way to retrieve that...
10
3077
by: Robert | last post by:
I have an app that was originally 1.1, now migrated to 2.0 and have run into some sporadic viewstate errors...usually saying the viewstate is invalid, eventvalidation failed or mac error. My web config does specify a machinekey setting: <machineKey validationKey="447C05E8B3A71401CC4CAE5513A7F1A3494A3618EE819316AAD1D58433F236A759D66FB4154500E01EB4E1BC1DE42046E2D652D391CB8367A1649438867A02EB"...
2
1237
by: rgrandidier | last post by:
I have a hidden element I add to the form each time dynamically, however, it seems that when I do a submit and change the hidden element value from 1 to 2, it displays it as 1 on the form even though I step through the code and it shows setting the hidden elements value as 2. What's up with this? How can I correct it? -- Robert
6
6247
by: scottrm | last post by:
Hi Users seem to be getting the following intermitent error whe they post a form. Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKeyconfiguration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.
6
1582
by: Rain | last post by:
Hi, I noticed the other day when I was trying to optimise the traffic on a particular web page that it had significant viewstate even though I had turned it off for most of the controls. So in a bold step I decided to attempt to set viewstate on the form itself off which had a massive impact on the viewstate like 80K to 15k. So my question is what is the significance of turning off the viewstate for the form and what information...
0
8448
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8356
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8871
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
7387
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6198
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1776
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.