/// <summary>
        ///
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="configContext"></param>
        /// <param name="section"></param>
        /// <returns></returns>
        public object Create(object parent, object configContext, XmlNode section)
        {
            var config = new HttpHandlersConfig((HttpHandlersConfig)parent);

            config.LoadValuesFromConfigurationXml(section);
            return(config);
        }
 internal HttpHandlersConfig(HttpHandlersConfig parent)
 {
     if (parent != null)
     {
         CacheViewSettings   = parent.CacheView;
         sessionViewSettings = parent.SessionView;
     }
 }
Beispiel #3
0
        /// <summary>
        /// Standard HttpHandler Entry point. Coordinate the displaying of the Session View
        /// </summary>
        /// <param name="context">The current HttpContext</param>
        public void ProcessRequest(HttpContext context)
        {
            //Only allow session viewing on requests that have originated locally
            if (Common.RequestIsLocal(context.Request) == false)
            {
                context.AddError(new ApplicationException("SessionView can only be accessed locally i.e. localhost"));
                return;
            }

            _HttpHandlerSettings = (HttpHandlersConfig)context.GetSection("sharedCache/httpHandlers");

            if (_HttpHandlerSettings == null ||
                (_HttpHandlerSettings.SessionView == null) ||
                (_HttpHandlerSettings.SessionView.Enabled == false))
            {
                //Session View is not enabled fire exception
                context.AddError(new ApplicationException(@"SessionView is not enabled. See the sharedCache\httpHandlers\ section in your configuration file", null));
                return;
            }

            _context  = context;
            _request  = context.Request;
            _response = context.Response;

            _writer = new HtmlTextWriter(_response.Output);

            _writer.Write("<html>\r\n");

            //Write out Html head and style tags
            _writer.Write("<head>\r\n");
            _writer.Write(pageStyle);
            _writer.Write("</head>\r\n");

            if (_context.Session.Mode != SessionStateMode.Off)
            {
                if (context.Request.QueryString["Item"] == null)
                {
                    //An item specific requets is NOT being made. Display the lot
                    EnumerateAndDisplaySessionState();
                }
                else
                {
                    //A session item specific request is being made. Try and display it
                    DisplaySessionStateItem();
                }
            }
            else
            {
                //Session state is off
                DisplaySessionStateOff();
            }

            _writer.Write("\r\n</body>\r\n</html>\r\n");
        }