473,748 Members | 10,737 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 <machineKeyconf iguration 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 6261
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*****@newsgr oup.nospamwrote in message
news:44******** *************** ***********@mic rosoft.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 <machineKeyconf iguration 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*****@newsgr oup.nospamwrote in message
news:44******** *************** ***********@mic rosoft.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 <machineKeyconf iguration 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 enableViewState Mac="true" or enableViewState Mac="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 <machineKeyconf iguration 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(en abled 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
"EnableViewStat eMac" and "viewStateEncry ptionMode" two configuration
options, and the "viewStateEncry ptionMode" 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(en abled 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
"EnableViewStat eMac" and "viewStateEncry ptionMode" two configuration
options, and the "viewStateEncry ptionMode" 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
4889
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 tags then 5 dropdownlist controls each containing the 5 Xml text tags). Problem,when I save the user DropDownList selected items by means of a button click the web form looses the PlaceHolder viewstate and generates the following error..."Object...
9
21646
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 the results in the grid. Say you filter the grid for records that have a certain condition set to "NO" (in this case a checkbox). In this scenario the search returns one result. If I then check the checkbox ("YES") and save it, I now get my message...
1
3753
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 with line 4, my application works. Using Line 1 in combination with line 3 (and of course renaming httpSessionState1 to httpSessionState) results in the error as mentioned below. protected override object LoadPageStateFromPersistenceMedium() {
2
1990
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 the majority of pages but kept them where absolutely necessary, such as shopping carts, adding items, etc. Also we've made sure the following have been met: EnableViewStateMac = false Disabled viewstate on all controls which are unnecessary...
11
2482
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 and in this case I redirect to another page, HOWEVER, I get Invalid ViewState exception. I know the problem stems from server.execute but don't know why. Any Ideas? Thank you.
9
4927
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 a static machinekey in the machine.config and that did not help. I believe that issue only occurred when there was an inconsistent viewstate error. The error I am faced with consistently occurs. Are there any known problems with the ViewState...
1
3456
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 RadioButtonList value, a postback is performed and the Panel's Visible property is set to true. Selecting a different RadioButtonList value sets the Visible property to false again. So far, so good. It does, in fact, do this.
10
3090
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"...
7
2143
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 webpage contains 2 dropdowns controls and I save information entered by user in ViewState variable containing array ArrayList MyCoordinates = (ArrayList) ViewState ; if (MyCoordinates == null) { MyCoordinates = new ArrayList ();
0
5742
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 with their OnClick events delegated to file.aspx. Here is my error (These happen fairly infrequently, say, 5-10 times an
0
8991
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
8830
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
9541
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
9370
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9321
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9247
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6074
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
4602
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...
1
3312
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.