Submit form

S

simon

I have page search.asp. When I click button, I submit form with script:

form1.action="searchResults.aspx"
form1.submit

On page searchResults.aspx I get the following error message:

The viewstate is invalid for this page and might be corrupted.

Does anybody know why?

Thank you,
Simon
 
M

Martin Marinov

To pass the current submit to another page use Server.Transfer method, which
will submit the current page and will pass the request to another page
Is there any special reason to do it like your way ?

Reagrds,
Martin
 
H

Hans Kesting

simon said:
I have page search.asp. When I click button, I submit form with script:

form1.action="searchResults.aspx"
form1.submit

On page searchResults.aspx I get the following error message:

The viewstate is invalid for this page and might be corrupted.

Does anybody know why?

Thank you,
Simon

I guess it is because you submit (probably via POST) to an aspx:
that aspx then expects a "postback", so tries to read the viewstate,
which normally is sent via a hidden input.
That input is not present (or not valid), therefore you get this error.

There is a way around this: you can set the directive
<%@ Page EnableViewStateMac="false" %>
in your aspx file.

I noticed you are trying to post from an asp to an aspx. (or is that a typo?)
The "usual" way for asp.net is to have an aspx page post to itself.
(then you won't have those viewstate problems)

Hans Kesting
 

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

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top