嗨,我有以下代码:ASP.net后与RUNAT =服务器错误:视图状态MAC的验证失败
<!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>
<title></title></head><body><form method="POST" action="search.aspx" runat="server"> Name <input type="text" name="Name"/>Age <input type="text" name="Age"/><input type="submit" /></form></body></html>
很简单asp.net形式两个字段的名字和年龄,一个提交按钮。但是当我点击提交按钮时,我收到以下错误:
验证视图状态MAC失败。如果此应用程序由Web Farm或群集托管,请确保配置指定相同的验证密钥和验证算法。 AutoGenerate不能在群集中使用。 描述:执行当前Web请求期间发生未处理的异常。请查看堆栈跟踪以获取有关该错误的更多信息以及源代码的位置。
异常详细信息:System.Web.HttpException:验证视图状态MAC失败。如果此应用程序由Web Farm或群集托管,请确保配置指定相同的验证密钥和验证算法。 AutoGenerate不能在群集中使用。
如果我从窗体中删除runat = server,则此错误消失。不幸的是,我有一个下拉列表,从表单标签中的runat = server从db中填充。任何想法为什么我不能发布使用runat =服务器? ,我将使用下拉列表中的代码如下:
<label>Location</label> <asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:web3ConnectionString1 %>"
SelectCommand="SELECT DISTINCT location FROM properties"></asp:SqlDataSource>
<asp:DropDownList id="location" runat="server" DataSourceID="SqlDataSource2" DataTextField="location" DataValueField="location" >
</asp:DropDownList>
而是简单的形式需要开始张贴值之前。
Regards, Sohail。
我不知道这是否是引起问题,但关蝙蝠我可以看到你的表单标签需要一个ID属性。 –