protected virtual void Page_PreInit(object sender, EventArgs e) { bool haveReportId = false; foreach (string key in Request.Params.Keys) { if ("Id".Equals(key)) { haveReportId = true; } } if (haveReportId) { SoftwareSystemComponentState state = SoftwareSystemComponentStateFacade.FindOrCreate(Context.User.Identity.Name, Token()); AccessController.Instance().VerifyPermissions(state, Token()); Context.Items[SoftwareSystemComponentStateFacade.HttpContextKey] = state; } else { Response.Redirect("~/Default.aspx", true); } }
// // Page Initialize // protected void Page_Init(object sender, EventArgs e) { if (SoftwareSystemComponentState == null) { SoftwareSystemComponentState state = SoftwareSystemComponentStateFacade.FindOrCreate( User.Identity.Name, Token); AccessController.Instance().VerifyPermissions(state, Token); SoftwareSystemComponentState = state; } }
public void OnPostAcquireRequestState(object sender, EventArgs args) { HttpRequest request = HttpContext.Current.Request; string configuration = WebConfigurationManager.AppSettings[Key]; int i = request.Path.IndexOf('/', 1) + 1; string path = request.Path.Substring(i, request.Path.Length - i); if (!string.IsNullOrEmpty(path)) { if (path.StartsWith("ErrorPage.aspx")) { return; } } else { path = "Default.aspx"; } try { string token = WebResourceRegistryCache.CacheCopy(configuration).SoftwareSystemComponent(path); SoftwareSystemComponentState state = SoftwareSystemComponentStateFacade.FindOrCreate(HttpContext.Current.User.Identity.Name, token); AccessController.Instance().VerifyPermissions(state, token); HttpContext.Current.Items.Add(SoftwareSystemComponentStateFacade.HttpContextKey, state); } catch (IndexOutOfRangeException) { // ignore the code } }