private void Application_BeginRequest(object source, System.EventArgs e) { this.currentApplicationType = HiConfiguration.GetConfig().AppLocation.CurrentApplicationType; HttpApplication httpApplication = (HttpApplication)source; HttpContext context = httpApplication.Context; if (context.Request.RawUrl.IndexOfAny(new char[] { '<', '>', '\'', '"' }) != -1) { context.Response.Redirect(context.Request.RawUrl.Replace("<", "%3c").Replace(">", "%3e").Replace("'", "%27").Replace("\"", "%22"), false); } else { this.CheckInstall(context); if (this.currentApplicationType != ApplicationType.Installer) { HiHttpModule.CheckSSL(HiConfiguration.GetConfig().SSL, context); HiContext.Create(context, new UrlReWriterDelegate(HiHttpModule.ReWriteUrl)); } } }
public static bool UpdateUser(IUser user) { bool result; if (null == user) { result = false; } else { bool flag = UserHelper.UpdateUser(user.MembershipUser); if (flag) { UserFactory userFactory = UserFactory.Create(user.UserRole); flag = userFactory.UpdateUser(user); HiContext current = HiContext.Current; if (current.User.UserId == user.UserId) { current.User = user; } } Users.ClearUserCache(user); result = flag; } return(result); }
public static HiContext Create(HttpContext context, bool isReWritten) { HiContext hiContext = new HiContext(context); hiContext.IsUrlReWritten = isReWritten; HiContext.SaveContextToStore(hiContext); return(hiContext); }
public static HiContext Create(HttpContext context, UrlReWriterDelegate rewriter) { HiContext hiContext = new HiContext(context); HiContext.SaveContextToStore(hiContext); if (null != rewriter) { hiContext.IsUrlReWritten = rewriter(context); } return(hiContext); }
private void Application_AuthorizeRequest(object source, System.EventArgs e) { if (this.currentApplicationType != ApplicationType.Installer) { HttpApplication httpApplication = (HttpApplication)source; HttpContext context = httpApplication.Context; HiContext current = HiContext.Current; if (context.Request.IsAuthenticated) { string name = context.User.Identity.Name; if (name != null) { string[] rolesForUser = Roles.GetRolesForUser(name); if (rolesForUser != null && rolesForUser.Length > 0) { current.RolesCacheKey = string.Join(",", rolesForUser); } } } } }
private static void SaveContextToStore(HiContext context) { context.Context.Items[dataKey] = context; }
public static HiContext Create(HttpContext context) { return(HiContext.Create(context, false)); }