我写了下面的代码登录后:System.Web.HttpException:无法向验证数据 - 发布网站
Session["IsLogin"] = false;
System.Configuration.Configuration config = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~");
if (txtPassword.Text.Trim() == string.Empty)
{
// Display Error
}
else
{
string Pwd = config.AppSettings.Settings["PWD"].Value.ToString();
FormsAuthenticationTicket formAuthTk = FormsAuthentication.Decrypt(Pwd);
string strDcryptedPwd = formAuthTk.Name.Trim().ToString();
if (txtPassword.Text.Trim() == strDcryptedPwd)
{
Session["IsLogin"] = true;
Response.Redirect("AnyPage.aspx");
}
else
{
// Error, Wrong password
}
}
这是运行良好通过Visual Studio运行时。但是,当我出版它它显示下面的错误:
System.Web.HttpException: Unable to validate data
注:
我发布上,我正在开发 网站的 同一台服务器上的应用程序。
我试过EnableViewStateMAC = 在页面级别为false。 [登录页]
这个错误的共鸣是什么?为什么只有在我发布该网站时才会出现? 。
在某些情况下,我在从VS2008运行时遇到错误。该错误来自`FormsAuthenticationTicket formAuthTk = FormsAuthentication.Decrypt(Pwd)行; ` – Chris 2011-02-09 13:24:37