http://www.codeproject.com/Articles/31914/Beginner-s-Guide-To-ASP-NET-Cookies
You can create a cookie (that will expire when the browser closed) to identify the first visit, and a never expire cookie to identify the visited user.
sample demo
// You need to call this code from all pages
protected void Page_Load(object sender, EventArgs e)
{
if (Request.Cookies["visited"] == null && Request.Cookies["firstVisit"] == null)
{
// Will expire when the browser closed
HttpCookie firstVisit = new HttpCookie("firstVisit", "true");
Response.Cookies.Add(firstVisit);
// Never expire cookie flag
HttpCookie visited = new HttpCookie("visited", "true");
visited.Expires = DateTime.Now.AddYears(100);
Response.Cookies.Add(visited);
}
// Detect status
if (Request.Cookies["firstVisit"] != null)
{
Response.Write("You are now in the first visit.<br />");
}
else
{
Response.Write("You have visited this site last time.<br />");
}
}
Rajeshk, if this helps please login to Mark As Answer. | Alert Moderator