Validation of viewstate MAC failed

M

Michael

Can anyone please help me with this problem. Thanks in advance.

I am using Microsoft Visual Web Developer 2008 Express Edition.

This is a very simple site containing two pages listed below.

1. first.aspx
2. second.aspx

first.aspx contains only a textbox and a button.

second.aspx contains nothing, it is simply a blank page.

Whenever I click on the button to submit the textbox information from
first.aspx to second.aspx, the following error is displayed:

--------------------------
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.
-------------------------------


There's not much to it, but below is the code to first.aspx.

-------------------Begin Code----------------
<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title></title>

</head>

<body>

<form id="form1" runat="server" action="second.aspx">


<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

&nbsp;

<asp:Button ID="Button1" runat="server" Text="Button" />


</form>

</body>

</html>

-------------------End Code----------------



Although second.aspx is just a blank page, the code for that page is listed
below.

-------------------Begin Code----------------

<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title></title>

</head>

<body>

<form id="form1" runat="server">

<div>


</div>

</form>

</body>

</html>

-------------------End Code----------------
 
C

Chris Taylor

Hi,

To initiate a cross page postback you should use the PostBackUrl property on
the button. The problem is caused by you having the action attribute set on
the server form and the action does not point to the original page.

Hope this helps
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top