473,756 Members | 8,552 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ViewState exception when submitting a page in Safari

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

document.getEle mentbyId(‘Folde rBrowser’).subm it();

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.Http Exception: 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.Conf iguration.Machi neKeySection.Ge tDecodedData(By te[] buf, Byte[] modifier, Int32 start, Int32 length, Int32& dataLength) +2546748
System.Web.UI.O bjectStateForma tter.Deserializ e(String inputString) +214

[ViewStateExcept ion: 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: /wEPDwUIOTA5OTg1 MThkZB0TdeU3bnO lPBB5jBLNh4FsKe D+
Referer: http://192.0.0.13/filewaytest/folderbrowser.aspx?
Path: /filewaytest/folderbrowser.a spx]

[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.V iewStateExcepti on.ThrowError(E xception inner, String persistedState, String errorPageMessag e, Boolean macValidationEr ror) +116
System.Web.UI.O bjectStateForma tter.Deserializ e(String inputString) +251
System.Web.UI.O bjectStateForma tter.System.Web .UI.IStateForma tter.Deserializ e(String serializedState ) +4
System.Web.UI.U til.Deserialize WithAssert(ISta teFormatter formatter, String serializedState ) +37
System.Web.UI.H iddenFieldPageS tatePersister.L oad() +220
System.Web.UI.P age.LoadPageSta teFromPersisten ceMedium() +83
System.Web.UI.P age.LoadAllStat e() +35
System.Web.UI.P age.ProcessRequ estMain(Boolean includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint) +6953
System.Web.UI.P age.ProcessRequ est(Boolean includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint) +154
System.Web.UI.P age.ProcessRequ est() +86
System.Web.Util .AspCompatAppli cationStep.Syst em.Web.HttpAppl ication.IExecut ionStep.Execute () +19
System.Web.Http Application.Exe cuteStep(IExecu tionStep step, Boolean& completedSynchr onously) +64

This application is not hosted by a web farm or cluster. I can get rid of this error by setting the enableViewState Mac=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.getEle mentbyId(‘Folde rBrowser’)..__V IEWSTATE.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 5058
jhardman
3,406 Recognized Expert Specialist
I get an error when submitting an .ASPX page in Safari beta, MAC and PC

document.getEle mentbyId(‘Folde rBrowser’).subm it();
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.Fo lderBrowser.sub mit():[/html]? (Assuming that 'FolderBrowser" is the name of the form you are submitting)

Jared
Sep 6 '07 #2
bperreault
1 New Member
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.StateForma tter.Deserializ e(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 Shimizu
2 New Member
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.Fo lderBrowser.sub mit():[/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.getEle mentbyId(‘Folde rBrowser’).subm it();

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
21647
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...
2
2606
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
1367
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 our site. When first time users come to the site they are redirected to a select location page where they need to select a country so we can show them proper pricing. However, users on the Mac seem to have issues during the redirect back to...
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...
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
1
2742
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 by a Web Farm or cluster, ensure that <machineKeyconfiguration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster”. Here is the scenario when I got the error.
3
680
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 my development machine. It seems that this is the only dll in the Bin folder that has this problem. Any help with this would be appreciated. Thanks, sck10
2
1729
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 properly, and the response is correct. When submitting from safari or chrome, the tag is sent properly (i've left the alert in place), and you can see that the variable is recieved in php properly, but then the query returns no results. This...
0
9212
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
9973
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
9790
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
9779
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
8645
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...
0
6473
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
5069
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
3742
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
2
3276
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.