473,396 Members | 1,755 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Puzzled about viewstate error

We have in our site the pages tag in the webroot tag like so.

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

But we are still getting errors during
LoadPageStateFromPersistenceMedium.

The stack trace is like so -
at System.Web.Configuration.MachineKey.GetDecodedData (Byte[] buf,
Byte[] modifier, Int32 start, Int32 length, Int32& dataLength)

at System.Web.UI.LosFormatter.Deserialize(String input)

I thought, that if enableViewStateMac was false that it wouldn't try
and decode the data and just base64 encode the view state so the above
method getdecodeddata wouldn't be called. Or am I wrong on that?
Also, we have the same machineKey in the file in the server farm.

Nov 19 '05 #1
5 1381
enableViewStateMac = false, just turns off using the servers's mac address
as part of the encryption key. you can gererate your own key, and place it
in the config (as must be done for a web frame).
-- bruce (sqlwork.com)
<je******@yahoo.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
We have in our site the pages tag in the webroot tag like so.

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

But we are still getting errors during
LoadPageStateFromPersistenceMedium.

The stack trace is like so -
at System.Web.Configuration.MachineKey.GetDecodedData (Byte[] buf,
Byte[] modifier, Int32 start, Int32 length, Int32& dataLength)

at System.Web.UI.LosFormatter.Deserialize(String input)

I thought, that if enableViewStateMac was false that it wouldn't try
and decode the data and just base64 encode the view state so the above
method getdecodeddata wouldn't be called. Or am I wrong on that?
Also, we have the same machineKey in the file in the server farm.

Nov 19 '05 #2
I don't think that is correct. I have already generated my own
encryption key using the machineKey tag in the web.config.

According to the documentation,
"EnableViewStateMAC - Specifies whether ASP.NET should run a message
authentication code (MAC) on the page's view state when the page is
posted back from the client. A view state MAC is an encrypted version
of the hidden variable that a page's view state is persisted to when
sent to the browser. If true, the encrypted view state is checked to
verify that it has not been tampered with on the client."

My interpretation is that if this is disabled it doesn't encrypt the
viewstate that is set to the hidden variable, hence, getdecodeddata
shouldn't be called.

Nov 19 '05 #3
Addendum: Here is the text from msdn on the machineKey entry

"Specifies the key used for validation of encrypted data. validationKey
is used when enableViewStateMAC is true to create a message
authentication code (MAC) to ensure that view state has not been
tampered with. validationKey is also used to generate out-of-process,
application-specific session IDs to ensure that session state variables
are isolated between sessions."

Nov 19 '05 #4
but if you look at the code (aways the source), you will see its always
encrypted, there are just 3 encryption methods, and ways to set the keys.

-- bruce (sqlwork.com)
<je******@yahoo.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
Addendum: Here is the text from msdn on the machineKey entry

"Specifies the key used for validation of encrypted data. validationKey
is used when enableViewStateMAC is true to create a message
authentication code (MAC) to ensure that view state has not been
tampered with. validationKey is also used to generate out-of-process,
application-specific session IDs to ensure that session state variables
are isolated between sessions."

Nov 19 '05 #5
No, that isn't correct. It isn't encrypted it is base64encoded. There
is a difference there one you need a machinekey to decode with the
other one you don't.

Nov 19 '05 #6

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

Similar topics

2
by: theo | last post by:
Hi... I wish to extract the text content of an Xml file and assign it to DropDownList controls at runtime.I can get the Xml file text content into the DropDownList controls (Ex...if 5 Xml text...
9
by: John Kirksey | last post by:
I have a page that uses an in-place editable DataGrid that supports sorting and paging. EnableViewState is turned ON. At the top of the page are several search fields that allow the user to filter...
1
by: Ralph Soons | last post by:
Hi all, I am trying to save the viewstate in a session instead of storing it in a hidden of the webpage which is default. This because of performance reasons. When I use line 2 in combination...
2
by: Janaka | last post by:
We have managed to lock down 99% of the application errors occurring in our asp.net sites. The only errors which occur on a regular basis now are viewstate errors. We have disabled viewstate on...
11
by: Nad | last post by:
Hello, I have a page with two link buttons. When I click on the first one I call server.execute("target.aspx") to view target.aspx on the original page. Then I click on the second link button...
9
by: Jamie | last post by:
I am receiving an Invalid ViewState error after posting back to the same page twice. Consistently the error occurs after the second postback and not after the first. I have looked into creating...
10
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...
7
by: GS | last post by:
Hello, I'm receiving The state information is invalid for this page and might be corrupted error message when running code below. This happens on second post back. Why is it happening? My...
0
by: tynorton | last post by:
Hey, I've been working on this issue for a while now, with no leads or success. The scenario is a homemade modal dialog using UpdatePanels. There a couple ImageButtons inside of usercontrols...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
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,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.