Welcome to MSDN Blogs Sign in | Join | Help

November 2007 - Posts

How to detect which control caused postback

public static Control GetPostBackControl(Page page) { Control control = null; string ctrlname = page.Request.Params.Get("__EVENTTARGET"); if (ctrlname != null && ctrlname != string.Empty) { control = page.FindControl(ctrlname); } else { foreach
Posted by Prakash | 1 Comments

How do I detect a session has expired and redirect it to another page

override protected void OnInit(EventArgs e) { base.OnInit(e); if (Context.Session != null) { if (Session.IsNewSession) { string szCookieHeader = Request.Headers["Cookie"]; if ((null != szCookieHeader) && (szCookieHeader.IndexOf("ASP.NET_SessionId")
Posted by Prakash | 2 Comments
 
Page view tracker