Ejemplo n.º 1
0
        public static void AddAdminLog(Kooboo.Data.Context.RenderContext context, RenderRespnose response)
        {
            if (response != null && response.ContentType != null && response.ContentType.ToLower().Contains("html"))
            {
                BackendLog model = new BackendLog();
                model.IP = context.Request.IP;
                if (context.User != null)
                {
                    model.UserId   = context.User.Id;
                    model.UserName = context.User.UserName;
                }
                model.Url        = context.Request.RawRelativeUrl;
                model.StatusCode = 200;

                if (context.Request.Cookies != null)
                {
                    foreach (var item in context.Request.Cookies)
                    {
                        model.Data[item.Key] = item.Value;
                    }
                }

                if (context.Request.Forms != null)
                {
                    foreach (var item in context.Request.Forms.AllKeys)
                    {
                        string key   = item;
                        string value = null;

                        var itemvalue = context.Request.Forms.GetValues(item);
                        if (itemvalue != null)
                        {
                            value = string.Join(";", itemvalue);
                        }

                        model.Data[key] = value;
                    }
                }

                if (context.Request.QueryString != null)
                {
                    foreach (var item in context.Request.QueryString.AllKeys)
                    {
                        string key   = item;
                        string value = null;

                        var itemvalue = context.Request.QueryString.GetValues(item);
                        if (itemvalue != null)
                        {
                            value = string.Join(";", itemvalue);
                        }

                        model.Data[key] = value;
                    }
                }

                Add(model);
                Kooboo.Data.Service.UserLoginService.UpdateLastPath(model);
            }
        }
Ejemplo n.º 2
0
        public bool ShouldTryHandle(Kooboo.Data.Context.RenderContext context, SpaRenderOption Options)
        {
            if (string.IsNullOrEmpty(Options.Prefix))
            {
                return(true);
            }
            string RelativeUrl = context.Request.RawRelativeUrl;

            if (RelativeUrl.ToLower().StartsWith(Options.Prefix.ToLower()))
            {
                return(true);
            }
            return(false);
        }
Ejemplo n.º 3
0
        public static bool DefaultTryShouldHandle(Kooboo.Data.Context.RenderContext context, RenderOption Options)
        {
            if (string.IsNullOrEmpty(Options.StartPath))
            {
                return(true);
            }

            string RelativeUrl = context.Request.RawRelativeUrl;

            if (RelativeUrl.ToLower().StartsWith(Options.StartPath.ToLower()))
            {
                return(true);
            }
            return(false);
        }
Ejemplo n.º 4
0
        public static string DefaultGetDbPath(Kooboo.Data.Context.RenderContext request)
        {
            string ExecutingFolder = AppDomain.CurrentDomain.BaseDirectory;

            return(System.IO.Path.Combine(ExecutingFolder, @"..\_renderdata"));
        }