52 lines
1.6 KiB
C#
52 lines
1.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using System.Runtime.Serialization.Json;
|
|
using Newtonsoft.Json;
|
|
using Newtonsoft.Json.Linq;
|
|
using System.Web.Services.Protocols;
|
|
using System.Security.Cryptography;
|
|
using System.Text;
|
|
using System.Web.SessionState;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
using Dapper;
|
|
|
|
namespace abbott_2024_event.BackEnd
|
|
{
|
|
public partial class logout : System.Web.UI.Page
|
|
{
|
|
SqlConnection conn = new SqlConnection(globalClass.appsettings("DBConnectionString"));
|
|
public authToken authToken;
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
authToken = new authToken();
|
|
string user_uid = authToken.user_uid;
|
|
|
|
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"];
|
|
|
|
try
|
|
{
|
|
string token = tokenCookie["token"];
|
|
string id = tokenCookie["uid"];
|
|
|
|
string delString = string.Format("delete token where token_key = '{0}' and user_uid = '{1}'", token, id);
|
|
conn.Execute(delString);
|
|
|
|
tokenCookie.Expires = DateTime.Now.AddDays(-10);
|
|
HttpContext.Current.Response.Cookies.Add(tokenCookie);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
}
|
|
|
|
|
|
Response.Redirect("Login.aspx");
|
|
}
|
|
}
|
|
} |