System.Web.HttpException: The viewstate is invalid for this pageand might be corrupted

  • Thread starter Thread starter Gvnn
  • Start date Start date
G

Gvnn

Hi,
I've a little problem, i've an asp.net page, with a runat server form,
like this:

<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="index.aspx.vb" Inherits="indexGstPro"%>
<HTML>
<HEAD>
</HEAD>
<body>
<form runat="server" method="post" id="indexGstPro">
</form>
</body>
</HTML>

now i want to go to another page by clicking a link, i've made this
javascript code:

document.indexGstPro.action = 'page.aspx';
document.indexGstPro.submit();

The page submits correctly, but the page i want to go return me this error:
System.Web.HttpException: The viewstate is invalid for this page and
might be corrupted

How can i solve the problem?

Gvnn
 
Gvnn,

ASP.NET pages do not support submission to a different page. If you need
to do this, you will need to programmatically disable Viewstate for the
page prior to posting back. Here's what I mean.

document.indexGstPro.__VIEWSTATE.disabled = true;
document.indexGstPro.action = 'page.aspx';
document.indexGstPro.submit();

Jim Cheshire [MSFT]
Developer Support
ASP.NET
(e-mail address removed)

This post is provided as-is with no warranties and confers no rights.

--------------------
 
Back
Top