View Single Post
Join Date: Nov 2008
Posts: 99
Reputation: csharplearner is an unknown quantity at this point 
Solved Threads: 3
csharplearner's Avatar
csharplearner csharplearner is offline Offline
Junior Poster in Training

Simple <Form> data error

 
0
  #1
Jan 2nd, 2009
Hello all,
I am trying to pass data between two files using POST method.
I am using Visual Studio 2008 and working in C# Environment to run this in ASP.net.

The code i am using is:
sareeweb.aspx

  1. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="sareeweb.aspx.cs" Inherits="_Default" %>
  2.  
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4.  
  5. <html xmlns="http://www.w3.org/1999/xhtml">
  6. <head runat="server">
  7. <title>Untitled Page</title>
  8. </head>
  9. <body>
  10. <form id="form1" action="logink.aspx" method="post" runat="server">
  11. <div>
  12.  
  13. Name <input type="text" name="Name"/>
  14. Age <input type="text" name="Age"/>
  15. <input type="submit" />
  16.  
  17. </div>
  18. </form>
  19. </body>
  20. </html>

logink.aspx

  1. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="logink.aspx.cs" Inherits="logink" debug="true"%>
  2.  
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4.  
  5. <html xmlns="http://www.w3.org/1999/xhtml">
  6. <head runat="server">
  7. <title>Untitled Page</title>
  8. </head>
  9. <body>
  10. <form id="form1" runat="server">
  11. <div>
  12. <%
  13. string name, age;
  14.  
  15. name = Request.Form["Name"];
  16. age = Request.Form["Age"];
  17. Response.Write(name);
  18. Response.Write(age);
  19. %>
  20.  
  21.  
  22. </div>
  23. </form>
  24. </body>
  25. </html>

This is all what i am using and i keep getting errors on logink.aspx

Errors:
Server Error in '/sareeweb' Application.
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.

Source Error:

[No relevant source lines]


Can some one please shed some light on this please

Thank you.
Reply With Quote