我在将HTML页面上的从GenericIdentity转换为FormsIdentity时遇到问题

时间:2019-06-20 17:09:05

标签: c# html asp.net-mvc

我有一个HTML页面,该页面是我的Web应用程序的一部分,当用户验证其电子邮件地址时,该页面将用作登录页面。问题是,当我尝试通过以下链接显示页面时:https://devweb.auditedmedia.com/MICenter/EmailCertification/EmailCertify?userName=kathryn@auditedmedia.com&memberNumber=1111475&certSentDate=636966249392940630 我收到一个错误,无法将类型为“ System.Security.Principal.GenericIdentity”的对象转换为类型为“ System.Web.Security.FormsIdentity”。 该链接在控制器EmailCertifiction中调用EmailCertify操作。

我不了解的是,此登录页面(据我了解)没有任何需要身份验证的内容,这就是为什么我不明白为什么收到错误消息的原因。

当我在本地运行网站(通过调试器),然后关闭它,但保持调试器正常运行并单击链接时,它将运行。

这是我的控制器EmailCertification的副本,其中包含EmailCertify操作以及其他一些功能

[System.Web.Http.HttpPost]
        public ActionResult EmailCertify(string userName, string memberNumber, string certSentDate)
        {
            DateTime certSentDT;

            long lngCertSent = long.Parse(certSentDate);

            certSentDT = new DateTime(lngCertSent);

            if (certSentDT < DateTime.Now.AddDays(-14))
                return Redirect("CertificationLinkExpired");

            if(EmailCertification.UpdateDBEmailCertified(userName, int.Parse(memberNumber), certSentDT)) return RedirectToAction("CertifyEmail");

            return RedirectToAction("CertifyEmailFailed");
        }

        public ActionResult CertifyEmail() => View();

        public ActionResult CertificationLinkExpired() => View();

        public ActionResult CertifyEmailFailed() => View();

        [System.Web.Http.Authorize]
        [System.Web.Http.HttpPost]
        public ActionResult EmailCertificationSent(EmailCertifiedModel certModel) => PartialView("_EmailCertificationSent", certModel);

以下是通过CertifyEmail()调用重定向的cshtml文件

@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <title>Email Certified</title>
    <meta charset="utf-8"/>
</head>
<body>
    <div>
        Thank you for certifying your email address.  <a href="https://abcas3.auditedmedia.com/MICenter/MICenter">Click here</a> to go to <a href="https://abcas3.auditedmedia.com/MICenter/MICenter">MIC login</a>
    </div>
</body>
</html>

我想发生的是显示HTML文件。有办法做到吗,还是我走的路不正确?

0 个答案:

没有答案