473,379 Members | 1,191 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,379 software developers and data experts.

ViewState exception when submitting a page in Safari

I get an error when submitting an .ASPX page in Safari beta, MAC and PC

document.getElementbyId(‘FolderBrowser’).submit();

After the server side code has executed without problems I get the following error.

Server Error in '/FileWayTest' Application.
--------------------------------------------------------------------------------
Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:
[HttpException (0x80004005): Unable to validate data.]
System.Web.Configuration.MachineKeySection.GetDeco dedData(Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Int32& dataLength) +2546748
System.Web.UI.ObjectStateFormatter.Deserialize(Str ing inputString) +214

[ViewStateException: Invalid viewstate.
Client IP: 192.0.0.80
Port: 4057
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en) AppleWebKit/522.15.5 (KHTML, like Gecko) Version/3.0.3 Safari/522.15.5
ViewState: /wEPDwUIOTA5OTg1MThkZB0TdeU3bnOlPBB5jBLNh4FsKeD+
Referer: http://192.0.0.13/filewaytest/folderbrowser.aspx?
Path: /filewaytest/folderbrowser.aspx]

[HttpException (0x80004005): Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.]
System.Web.UI.ViewStateException.ThrowError(Except ion inner, String persistedState, String errorPageMessage, Boolean macValidationError) +116
System.Web.UI.ObjectStateFormatter.Deserialize(Str ing inputString) +251
System.Web.UI.ObjectStateFormatter.System.Web.UI.I StateFormatter.Deserialize(String serializedState) +4
System.Web.UI.Util.DeserializeWithAssert(IStateFor matter formatter, String serializedState) +37
System.Web.UI.HiddenFieldPageStatePersister.Load() +220
System.Web.UI.Page.LoadPageStateFromPersistenceMed ium() +83
System.Web.UI.Page.LoadAllState() +35
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6953
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +154
System.Web.UI.Page.ProcessRequest() +86
System.Web.Util.AspCompatApplicationStep.System.We b.HttpApplication.IExecutionStep.Execute() +19
System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean& completedSynchronously) +64

This application is not hosted by a web farm or cluster. I can get rid of this error by setting the enableViewStateMac=false, however this causes other problems, and besides which I understand this “fix” raises security issues. I can also get rid of this error by executing the following code before the submit.

document.getElementbyId(‘FolderBrowser’)..__VIEWST ATE.name="name";

This also causes other problems, and has unusual side effects on the page.

Can anyone help me?

Ken Shimizu
Everywhere Networks Corporation
Ottawa, Canada
[removed email address. please contact via PM]
Sep 5 '07 #1
3 5038
jhardman
3,406 Expert 2GB
I get an error when submitting an .ASPX page in Safari beta, MAC and PC

document.getElementbyId(‘FolderBrowser’).submit();
Ken,

I removed your email address, because this is supposed to be a forum for discussions, others may want to see this solution.

In answer to your question, can you not say say:
[html]document.all.FolderBrowser.submit():[/html]? (Assuming that 'FolderBrowser" is the name of the form you are submitting)

Jared
Sep 6 '07 #2
Ken,

That's the same problem I've been fighting for some time. I don't know how to solve this, except to keep looking for workarounds. I have no clue how to work around this issue. Removing the view state from the page does not fix. I implemented (from an article on 4GuysFromRolla) code that persists page state to a file - hoping this would be the solution.

I got further in Safari than before, but there is still an issue:

Expand|Select|Wrap|Line Numbers
  1. [HttpException (0x80004005): Unable to validate data.]
  2.    System.Web.Configuration.MachineKeySection.GetDecodedData(Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Int32& dataLength) +2646292
  3.    System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +214
  4. System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +251
  5. System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String serializedState) +4
  6.    FileSystemPageStatePersister.Load() in c:\cccWebStore\WebStoreUI\App_Code\StatePersister\FileSystemPageStatePersister.cs:34
  7.    System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +83
  8.    System.Web.UI.Page.LoadAllState() +35
  9.  
  10.  
  11. [ViewStateException: Invalid viewstate. 
  12.     Client IP: 127.0.0.1
  13.     Port: 
  14.     User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en) AppleWebKit/522.13.1 (KHTML, like Gecko) Version/3.0.2 Safari/522.13.1
  15.     ViewState: /wEPDwUKMTU0NjE1MjA3O...]
  16.  
  17. [HttpException (0x80004005): Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.]
  18.    System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError) +116
--------------------------------------------------
The line of code which is throwing that error is the line that translates what was retrieved from disk for the viewstate contents. This is on my development machine. Not production or remote.

pair = base.StateFormatter.Deserialize(contents) as Pair;

I appreciate any information that can be obtained from the experts here. It's a bug, yep. But how do we work around it?

BPerreault
Sep 13 '07 #3
Ken,

I removed your email address, because this is supposed to be a forum for discussions, others may want to see this solution.

In answer to your question, can you not say say:
[html]document.all.FolderBrowser.submit():[/html]? (Assuming that 'FolderBrowser" is the name of the form you are submitting)

Jared
Sorry about the email address, I generally include it in all my correspondance. To answer your question, we used to use a simpler syntax to specify the form but we changed it to:

document.getElementbyId(‘FolderBrowser’).submit();

I believe (I'm not sure) we did it to make the code compatible with certain versions of Firefox.

By the way I found that the problem that I was having seemed to stem from the manner in which the previous form invoked the current form, when I changed the code to skip the previous form the error went away. So that's what I plan to do.

Ken
Sep 28 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

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...
2
by: Mike | last post by:
hi to all does any body know or receive this message before and how i can repare this: The viewstate is invalid for this page and might be corrupted. thank's Mike
0
by: Ian Lane .enizin.net> | last post by:
Hello, I am having a very strange issue regarding our macintosh users running IE. For some reason some users running IE on the Mac are getting an invalid viewstate exception when first coming to...
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...
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...
1
by: =?Utf-8?B?VmlqYXkgQ2hpa3Rl?= | last post by:
Hi Experts, With Session Affinity and Web Server Farm on ISA Server 2006 accessing 2 backend IIS servers, I’m getting error “Validation of ViewState MAC failed. If this application is hosted...
3
by: sck10 | last post by:
Hello, I have a web project (VS 2008 c#). I have a page that opens, but when I try to call an assembly (managed c++) on a submit event, I get the following error on the web server, but not on...
2
by: pedalpete | last post by:
I know this doesn't sound right as how can php be different in safari vs ie/ff, but i've been updating a genre list on my page to a tag cloud. When submitting the form using ie/ff the tag is sent...
1
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: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...

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.