예제 #1
0
        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));
                }
            }
        }
예제 #2
0
        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);
        }
예제 #3
0
        public static HiContext Create(HttpContext context, bool isReWritten)
        {
            HiContext hiContext = new HiContext(context);

            hiContext.IsUrlReWritten = isReWritten;
            HiContext.SaveContextToStore(hiContext);
            return(hiContext);
        }
예제 #4
0
        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);
        }
예제 #5
0
 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);
                 }
             }
         }
     }
 }
예제 #6
0
 private static void SaveContextToStore(HiContext context)
 {
     context.Context.Items[dataKey] = context;
 }
예제 #7
0
 public static HiContext Create(HttpContext context)
 {
     return(HiContext.Create(context, false));
 }