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

corrupt viewstate on form.submit

Hello,

I hope some one can answer this for me.

I am using .NET version 1.0 on Windows 2000Pro and I am
getting an error when doing a form submit from an HTML
control. Please look at the following brief code example:

I have two aspx file WebForm1.aspx and WebForm2.aspx.
WebForm1 has the following elements:
....
<form id="Form1" method="post" action="" runat="server">
<input id="h1" name="h1" value="1" type="hidden">
<input type="button" id="btnGo" name="btnGo" value="GO"
onclick="CallGo()">
</form>
....

This is the code for function CallGo:
<script language="javascript">
function CallGo()
{
document.forms('Form1').action = 'WebForm2.aspx';
document.forms('Form1').submit();
}
</script>

I added no code to the code-behind page for WebForm1.

When I click on button GO, the client side CallGo function
exectues but I get the following error at the submit point:
'The View State is invalid for this page and might be
corrupted.'

However, if I take out the runat=server attribute from the
form element above, everything works as expected.

I need to use the runat=server attribute on the form
element because I will be adding code in the code-behind
page for it. Can anyone explain how to get around this
error?

Much appreciated!
Tony
Jul 21 '05 #1
1 2198
It's a long shot, but see if your page has "viewstateMac" enabled. Turning
this off might help solve the problem.
If not, do you have problems running "normal" pages generated by Visual
Studio (for example) ?

--

Regards

Tim Stephenson MCSD.NET
Charted MCAD & MCSD.NET Early Achiever


"Tony Hedge" <be*************@yahoo.com> wrote in message
news:08****************************@phx.gbl...
Hello,

I hope some one can answer this for me.

I am using .NET version 1.0 on Windows 2000Pro and I am
getting an error when doing a form submit from an HTML
control. Please look at the following brief code example:

I have two aspx file WebForm1.aspx and WebForm2.aspx.
WebForm1 has the following elements:
...
<form id="Form1" method="post" action="" runat="server">
<input id="h1" name="h1" value="1" type="hidden">
<input type="button" id="btnGo" name="btnGo" value="GO"
onclick="CallGo()">
</form>
...

This is the code for function CallGo:
<script language="javascript">
function CallGo()
{
document.forms('Form1').action = 'WebForm2.aspx';
document.forms('Form1').submit();
}
</script>

I added no code to the code-behind page for WebForm1.

When I click on button GO, the client side CallGo function
exectues but I get the following error at the submit point:
'The View State is invalid for this page and might be
corrupted.'

However, if I take out the runat=server attribute from the
form element above, everything works as expected.

I need to use the runat=server attribute on the form
element because I will be adding code in the code-behind
page for it. Can anyone explain how to get around this
error?

Much appreciated!
Tony

Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Trevor Andrew | last post by:
Hi There, I have a small ASP.NET application under development. I am using VS.NET 2002 (2003 upgrade is on the way) with .NET Framework 1.1. It is hosted on a web hosting service in the US. I am...
6
by: Robin Bonin | last post by:
In my user contol I am creating a set of dropdownlists. Each list is created based on input from the other lists. The problem I am having is setting the selected index on the lists. If someone...
3
by: foldface | last post by:
Hi I have only just become aware that form values posted to the server don't need to be preserved in viewstate because asp.net preserves them anyway separately from this. 2 questions (1) What is...
5
by: sjl | last post by:
I've got an .aspx webform for searching my database. It basically takes user input and passes it as a parm into a stored proc to search a table. The results are returned in a SQLDataReader and...
1
by: Tony Hedge | last post by:
Hello, I hope some one can answer this for me. I am using .NET version 1.0 on Windows 2000Pro and I am getting an error when doing a form submit from an HTML control. Please look at the...
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...
1
by: Savas Ates | last post by:
I wantto submit my form to another page without using viewstate. I used EnableViewState="false" in my page directive <%@ Page EnableViewState="false" Language="vb" AutoEventWireup="false"...
1
by: Arpan | last post by:
Consider the following code snippet: <script runat="server"> Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs) If Not (Page.IsPostBack) Then MsgBox(1) ViewState("StartTime") =...
5
by: AlexC | last post by:
Hi, i have just read some threads about viewstate and wanted to test myself. But there must be something i don't undertstand, because when i submit the form with EnableViewState="false", i get...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
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,...
0
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,...

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.