bremen_short_url/BackEnd/logout.aspx.cs

45 lines
1.4 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;
public partial class logout : System.Web.UI.Page
{
public authPermission objAuth;
protected void Page_Load(object sender, EventArgs e)
{
objAuth = new authPermission();
string user_uid = objAuth.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);
autoExecSQL objExec = new autoExecSQL(delString);
tokenCookie.Expires = DateTime.Now.AddDays(-10);
HttpContext.Current.Response.Cookies.Add(tokenCookie);
}
catch (Exception ex)
{
}
Server.Transfer("Login.html");
}
}