How to form submit and show a different page in ASP.Net MVC?

Posted by melaos on Stack Overflow See other posts from Stack Overflow or by melaos
Published on 2010-04-08T16:09:19Z Indexed on 2010/04/08 16:13 UTC
Read the original article Hit count: 392

Filed under:
|
|
|
|

hi guys

i'm new to asp.net mvc..

so basically i just build up a two page app which takes the registration information of the user and post it to the database.

i use a lot of jquery and ajax calls to retrieve data from the database using linq to sql stored proc object.

and currently i'm stuck at one page where after the user submits the form it should redirect him to /Home/AddProduct.

What i found was the error:

 Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.

what used on my form are basically a combination of html controls, asp.net controls and some asp.net mvc type controls.

i submit the form using action="/Home/ProductAdded" and after doing some googling i found i was supposed to add in the machine key but after doing so, the index page becomes unviewable. because it couldn't find the index file now.

removing the action helps, but now it just doesn't go anywhere. so what am i missing here?

i feel i'm missing a lot of fundamentals understanding about asp.net mvc and i don't even know how to submit a form and go to a different page here!!

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about mvc