ログイン用に次のコードを作成しました。
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: データを検証できません
ノート:
サイトを開発しているのと同じサーバーでアプリケーションを公開します。
ページレベルで EnableViewStateMAC = false を試しました。【ログインページ】
このエラーの原因は何ですか? サイトを公開したときにのみ表示されるのはなぜですか?