40 lines
1.3 KiB
C#
40 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace abbott_2024_event.BackEnd
|
|
{
|
|
|
|
public partial class Main : System.Web.UI.MasterPage
|
|
{
|
|
public authToken authToken;
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
authToken = new authToken();
|
|
|
|
if (authToken.user_isLogin == false) {
|
|
HttpCookie tokenCookie = (HttpContext.Current.Request.Cookies["token"] == null) ? null : HttpContext.Current.Request.Cookies["token"];
|
|
HttpCookie idCookie = (HttpContext.Current.Request.Cookies["id"] == null) ? null : HttpContext.Current.Request.Cookies["id"];
|
|
|
|
HttpContext.Current.Response.Cookies["token"].Expires = DateTime.Now.AddDays(-1);
|
|
|
|
if (tokenCookie != null) {
|
|
tokenCookie.Expires = DateTime.Now.AddDays(-10);
|
|
tokenCookie.Values.Clear();
|
|
|
|
HttpContext.Current.Response.Cookies.Set(tokenCookie);
|
|
|
|
HttpContext.Current.Response.Cookies.Add(new HttpCookie("token", ""));
|
|
}
|
|
|
|
|
|
|
|
Response.Redirect("Login.html?isLogout=true");
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
} |