Tag: formsauthenticationticket

检查身份validation票证到期而不影响它

我正在尝试实现一个Web应用程序项目,我的网页可以使用AJAX检查服务器的身份validation票证到期日期/时间。 我正在使用带有slidingExpiration的Forms身份validation。 我遇到的问题是我无法弄清楚如何在不重置的情况下检查值。 我创建了一个简单的页面 – CheckExpiration.aspx – 下面是代码背后的代码: private class AjaxResponse { public bool success; public string message; public string expirationDateTime; public string secondsRemaining; public string issueDate; } protected void Page_Load(object sender, EventArgs e) { AjaxResponse ar = new AjaxResponse(); JavaScriptSerializer js = new JavaScriptSerializer(); if (HttpContext.Current.User.Identity.IsAuthenticated) { FormsIdentity id = (FormsIdentity)HttpContext.Current.User.Identity; string expiration = […]