corrupt viewstate on form.submit

T

Tony Hedge

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
 
T

Tim Stephenson

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
 

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

Top