-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogout.aspx.cs
38 lines (33 loc) · 1.01 KB
/
logout.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;
using DataScrapingHelper;
namespace SohhScrape
{
public partial class logout : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//When user logs out clear session variables...
Session["cookies"] = new CookieContainer();
Session["username"] = String.Empty;
//... and Cookies
HttpCookie aCookie;
string cookieName;
int limit = Request.Cookies.Count;
for (int i = 0; i < limit; i++)
{
cookieName = Request.Cookies[i].Name;
aCookie = new HttpCookie(cookieName);
aCookie.Expires = DateTime.Now.AddDays(30);
Response.Cookies.Add(aCookie);
}
//Redirect to home page
Response.Redirect("index.aspx");
}
}
}