views:

264

answers:

2

I'm working on a web form which works fine as long as it posts back to itself. In Reports.aspx I have:

<form runat="server" method="post">

but, when I try to get it to post to a different page:

<form runat="server" method="post" action="DisplayReport.aspx">

I get the "Validation of viewstate MAX failed" error. I've tried setting the machine key and disabling the viewstate in web.config, but nothing seems to help. Am I stuck posting back to the same page? If so what is the point of the action attribute?

A: 

Cross page post backs should be available, you just have to set them up as so. See this link http://csharpdotnetfreak.blogspot.com/2009/08/cross-page-posting-in-aspnet.html

andrewWinn
+1  A: 

You can submit to a different page, but you need to use the PostBackUrl property of a button, not the form's action attribute.

Instead of this:

<form runat="server" method="post" action="DisplayReport.aspx">
    <!-- form stuff goes here -->
    <asp:button runat="server" text="Submit" />
</form>

Do this:

<form runat="server">
    <!-- form stuff goes here -->
    <asp:button runat="server" text="Submit" postbackurl="DisplayReport.aspx" />
</form>
LukeH
perfect. thank you
Ferruccio
this still doesn't explain what's the point of Action attribute?
gnomixa