Hello every one, I would appreciate any help in hoe to generate a persistent session ID in Master Page.
Thanks
Persistent session in Master Page
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Kirtan PatelRank #292 · 8.6K reputationPosted Nov 14, 2009, 6:59 PM EST
you can Generate Session ID in master page also Store the SessionID in Cookie that will presist SessionID even for Months too..
Here is Code How to Set Cookies
public partial class MasterPage : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
string SessionID = HttpContext.Current.Session.SessionID;
// Set cookieHttpCookie cookie = new HttpCookie("CookieName",SessionID);
cookie.Expires = DateTime.Now.AddMinutes(60);
Response.AppendCookie(cookie);
}}