473,320 Members | 2,147 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,320 software developers and data experts.

viewstate error

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.

We are not in a cluster situation. I believe it may be because there is a
delay in posting back so the viewstate is expiring. I wanted to know if there
is any way to increase the timeout of the view state, is it bound to the
session timeout (we are not using forms authentication)?

Alternatively any way to turn this viewstate check off (it is a restriced
admin site so there should be no security problems although I would prefer
just to extend the timeout)


--
Scott
Oct 11 '06 #1
6 6226
ViewState does not timeout. It is an encrypted string in your page (hidden
field). There is a setting on the @Page directive for ViewStateMac. Set it
both ways (forget which setting cures this, but a google might solve it).
The second thing to do is generate your keys. You can find machineKey
generators on the web.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com

*************************************************
Think outside of the box!
*************************************************
"scottrm" <sc*****@newsgroup.nospamwrote in message
news:44**********************************@microsof t.com...
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.

We are not in a cluster situation. I believe it may be because there is a
delay in posting back so the viewstate is expiring. I wanted to know if
there
is any way to increase the timeout of the view state, is it bound to the
session timeout (we are not using forms authentication)?

Alternatively any way to turn this viewstate check off (it is a restriced
admin site so there should be no security problems although I would prefer
just to extend the timeout)


--
Scott

Oct 11 '06 #2
Hi

Thanks for your reply, I think I was not being that clear, I am aware view
state itself does not time out as such but according to what I read "
ASP.NET will perform a simple digest on the viewstate and check it later
when page postback, however, this digest is not valid forever"

Also would setting the key make any difference in a non-cluster environment.

Scott
--
Scott
"Cowboy (Gregory A. Beamer)" wrote:
ViewState does not timeout. It is an encrypted string in your page (hidden
field). There is a setting on the @Page directive for ViewStateMac. Set it
both ways (forget which setting cures this, but a google might solve it).
The second thing to do is generate your keys. You can find machineKey
generators on the web.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com

*************************************************
Think outside of the box!
*************************************************
"scottrm" <sc*****@newsgroup.nospamwrote in message
news:44**********************************@microsof t.com...
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.

We are not in a cluster situation. I believe it may be because there is a
delay in posting back so the viewstate is expiring. I wanted to know if
there
is any way to increase the timeout of the view state, is it bound to the
session timeout (we are not using forms authentication)?

Alternatively any way to turn this viewstate check off (it is a restriced
admin site so there should be no security problems although I would prefer
just to extend the timeout)


--
Scott


Oct 11 '06 #3
There's a web.config key that you can set to enable or disable the ViewStateMac
setting.

In your <pagestag, add enableViewStateMac="true" or enableViewStateMac="false".

-dl

--
David Longnecker
Web Developer
http://blog.tiredstudent.com
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.

We are not in a cluster situation. I believe it may be because there
is a delay in posting back so the viewstate is expiring. I wanted to
know if there is any way to increase the timeout of the view state, is
it bound to the session timeout (we are not using forms
authentication)?

Alternatively any way to turn this viewstate check off (it is a
restriced admin site so there should be no security problems although
I would prefer just to extend the timeout)

Oct 11 '06 #4
Hello Scott,

As for the ViewState validation error you encountered, there does exists
some issue that will result to the behavior. One is hosting web applicaiton
in webfarm environment which cause request send to different server (with
different machinekey) raise viewstate validation error. Another problem is
as you said, the ViewStateMac(enabled by default) is a randomly generated
digest value and it is not expected to work forever, and that's why
sometimes the server will also raise such error when use pickup a url from
the webcrawler's search result cache(which contains invalid viewstate
content).

So far, the ASP.NET's ViewState setting only provide the
"EnableViewStateMac" and "viewStateEncryptionMode" two configuration
options, and the "viewStateEncryptionMode" is specific to viewstate
encryption which is not used normally. As for ViewStateMac, we can only
control whether to enable it, but can not control the valid lifecycle of
the generated MAC value(it is internally fixed). BTW, since the error
will raise occasionally when the user postback a form after a long period
idle, do you think it possible that you embed some client-script in your
certain page (which need such protetion) and automatically postback the
form after a certain long period? Thus, if the user hasn't perform any
action on the form for a long time, the page will postback itself to make
its states refresh. Also, you can disable ViewStatemac for the certain
pages, however, there will still raise server-side exception when the
ViewState is corrupted.

Please feel free to post here if you have any other ideas or questions.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Oct 12 '06 #5
Hi

Thanks for your reply, does the sentence "Also, you can disable ViewStatemac
for the certain pages, however, there will still raise server-side exception
when the
ViewState is corrupted." mean that changing the ViewStatemac setting even in
the web.config will not necessarily fix the problem?

Scott
--
Scott
"Steven Cheng[MSFT]" wrote:
Hello Scott,

As for the ViewState validation error you encountered, there does exists
some issue that will result to the behavior. One is hosting web applicaiton
in webfarm environment which cause request send to different server (with
different machinekey) raise viewstate validation error. Another problem is
as you said, the ViewStateMac(enabled by default) is a randomly generated
digest value and it is not expected to work forever, and that's why
sometimes the server will also raise such error when use pickup a url from
the webcrawler's search result cache(which contains invalid viewstate
content).

So far, the ASP.NET's ViewState setting only provide the
"EnableViewStateMac" and "viewStateEncryptionMode" two configuration
options, and the "viewStateEncryptionMode" is specific to viewstate
encryption which is not used normally. As for ViewStateMac, we can only
control whether to enable it, but can not control the valid lifecycle of
the generated MAC value(it is internally fixed). BTW, since the error
will raise occasionally when the user postback a form after a long period
idle, do you think it possible that you embed some client-script in your
certain page (which need such protetion) and automatically postback the
form after a certain long period? Thus, if the user hasn't perform any
action on the form for a long time, the page will postback itself to make
its states refresh. Also, you can disable ViewStatemac for the certain
pages, however, there will still raise server-side exception when the
ViewState is corrupted.

Please feel free to post here if you have any other ideas or questions.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Oct 13 '06 #6
Thanks for your reply Scott,

Yes, IMO "turn off ViewStateMac" is not the way to fix the problem. This is
because if we turn off the ViewStateMac check, when a problem page (with
invalid viewstate) postback, the server-side will not verify the viewstate
since MAC is turned off, however, when the page framework parse the
viewstate, it will encounter problem which will raise some unexpected error
and this will be more ambiguous than a ViewState validation error. Do you
think so?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Oct 16 '06 #7

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...
1
by: Tim | last post by:
Greetings! I have a UserControl. On this UserControl is a Panel and a RadioButtonList. The Panel's Visible property is set to false by default. When the user selects a particular...
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
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.