cookie 保存上次访问url方法
if (Session[Enums.UserInfoSeesion] == null)
{
HttpCookie cookie = Request.Cookies[Enums.UserLastAccessUrl];
string[] arr = Request.Url.ToString().Split('?');
string url = Request.Url.ToString();
if (arr.Length > 1)
{
url = arr[0];
}
if (cookie == null)
{
cookie = new HttpCookie(Enums.UserLastAccessUrl) { Value = url, HttpOnly = true, Expires = DateTime.Now.AddMinutes(10) };
}
else
{
cookie.Value = url;
Response.Cookies.Remove(Enums.UserLastAccessUrl);
}
Response.Cookies.Add(cookie);
//没有登入
Response.Write("<script>alert('您还没有登入');window.location='UserLogin.aspx';</script>");
Response.End();
}