public class BasePage : System.Web.UI.Page { protected override void OnInit(EventArgs e) { base.OnInit(e); if (Session["User"] == null) { HttpContext context = HttpContext.Current; context.Response.Redirect("Login.aspx?url=" + context.Request.Url.ToString()); } } }