Asp.net 登录控制问题

Asp.net 登录控制问题,asp.net,login,Asp.net,Login,我是软件工程和web开发课程的大三学生,遇到了一个问题。我需要一个登录页面,以便在用户单击“登录”按钮后,他们将被发送到我的实际网页。但是,每次单击“登录”按钮时,我都会收到以下错误: Server Error in '/Case04' Application. Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKe

我是软件工程和web开发课程的大三学生,遇到了一个问题。我需要一个登录页面,以便在用户单击“登录”按钮后,他们将被发送到我的实际网页。但是,每次单击“登录”按钮时,我都会收到以下错误:

Server Error in '/Case04' 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."
“/Case04”应用程序中出现服务器错误。 viewstate MAC验证失败。如果此应用程序由Web场或群集托管,请确保配置指定了相同的validationKey和验证算法。无法在群集中使用自动生成。 描述:执行当前web请求期间发生未处理的异常。请查看堆栈跟踪以了解有关错误的更多信息以及错误在代码中的起源。 异常详细信息:System.Web.HttpException:viewstate MAC验证失败。如果此应用程序由Web场或群集托管,请确保配置指定了相同的validationKey和验证算法。无法在群集中使用自动生成。“ 对于这个特定的项目,我不关心用户输入什么,只要他们输入信息。我只需要它,所以当点击登录按钮时,我会被发送到我的实际网页,即pc.aspx

这是我的密码:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="Login"  %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<link href="login.css" rel="stylesheet" type="text/css" />
    <title></title>
</head>
<body>
<%--Heading--%>
<form name="c_order" id="c_order" runat="server" 
action="pc.aspx" method="get">
<table>
    <tr>
        <td>
            <img src="mclogog.jpg" alt="heading" id="heading" />
        </td>
    </tr>
</table>

<%--login--%>
<asp:Login ID="login" class="login" runat="server" size="10" maxlength="25" EventValidation="false"></asp:Login>
<p id="member" >Already a member?</p>

<%--fieldset for new user --%>
<fieldset>
 <legend id="bill">Shipping Information</legend>
       <label for="fname" >First Name<span>*</span></label>
       <input type="text" name="fname" id="fname" size="27" />
       <label for="lname"> Last Name<span>*</span></label> 
       <input type="text" name="lname" id="lname" size="27" />
       <label for="address1">Address #1<span>*</span></label>
       <input type="text" name="address1" id="address1" size="57" />
       <label for="address2">Address #2</label>
       <input type="text" name="address2" id="address2" size="57" />
       <label for="city">City<span>*</span></label></td>
       <input type="text" name="city" id="city" size="40" />
       <label for="state">State<span>*</span> </label>
       <input type="text" name="state" id="state" size="3" />
       <label for="zip">ZIP<span>*</span> </label>
       <input type="text" name="zip" id="zip" size="10" maxlength="10" />
       <label for="country">Country<span>*</span></label>
       <input type="text" name="country" id="country" size="40" value="United States" />
      <p id="ast">
        * = Required field, must be filled in. 
      </p>     
</fieldset>
</form>
</body>
</html>

已经是会员了吗

装运信息 名字* 姓氏* 地址#1* 地址#2 城市* 国家* 拉链* 国家*

*=必填字段,必须填写。


如果您能提供帮助,我将不胜感激!

问题在于您的页面没有处理自己的事件。您已设置了
标记以将其值发回另一个页面

action=“pc.aspx”../>但是您的页面实际上被称为login.aspx。因此,当此表单的内容发布到pc.aspx时,它无法解码viewstate,因为它不是来自pc.aspx.cs。它来自不同的页面

从表单标记中删除操作属性。如下所示:

<form name="c_order" id="c_order" runat="server" method="get">


这是托管在一台服务器上还是在web服务器场环境中?您收到的错误是因为从客户端返回的页面上的viewstate与服务器最初发送的内容不匹配。可能是因为您正在访问服务器场中的另一台服务器?谢谢!工作正常。