Beispiel #1
0
        public Core(Server server, HttpContext context, string viewstate = "", string type = "")
        {
            Server = server;
            Context = context;
            Request = context.Request;
            Response = context.Response;
            Session = context.Session;
            Sql = new Sql(this);
            Util = new Utility.Util(this);
            User = new User();

            //load viewstate
            if (useViewState == true)
            {
                ViewStateId = viewstate;
                if(ViewStateId == "") { ViewStateId = Util.Str.CreateID(); }
                if (Session["viewstate-" + ViewStateId] != null)
                {
                    ViewState vs = new ViewState();
                    vs = (ViewState)Util.Serializer.ReadObject(Util.Str.GetString(Session["viewstate-" + ViewStateId]), vs.GetType());
                    Page = vs.Page;
                    Elements = new Elements(this, Page.themeFolder);
                }else { Page = new Page(); }
            }else { Page = new Page(); }

            if (Session["user"] != null)
            {
                User = (User)Util.Serializer.ReadObject(Util.Str.GetString(Session["user"]), User.GetType());
            }

            //load references to Core R
            Sql.Load();
            Page.Load(this);
            User.Load(this);

            //generate visitor id
            if (User.visitorId == "" || User.visitorId == null) { User.visitorId = Util.Str.CreateID(); }

            //detect request type & host type
            if (type == "service") { isWebService = true; }
            if (Request.Host.Value.IndexOf("localhost") >= 0 || Request.Host.Value.IndexOf("192.168.") >= 0) { isLocal = true; }
        }
Beispiel #2
0
 public void Init(User u)
 {
     myUser = u;
 }
Beispiel #3
0
 public WebsiteSecurity(User u)
 {
     myUser = u;
     securityItems = new List<structSecurityFeature>();
 }