Ejemplo n.º 1
0
        public HttpContextProxy(String fileName, String queryString)
            : base()
        {
            MemoryStream responseStream = new MemoryStream();
            TextWriter responseWriter = new StreamWriter(responseStream);
            HttpWorkerRequest wr = new SimpleWorkerRequest("/", @"C:\inetpub\wwwroot\", fileName, queryString, responseWriter);
            HttpContext context = new HttpContext(wr);
            HttpBrowserCapabilities browser = new HttpBrowserCapabilities();
            browser.SetFieldValue("_items", new Hashtable());
            context.Request.Browser = browser;

            HttpContext previousContext = HttpContext.Current;
            HttpContext.Current = context;

            this._context = context;
            this._previousContext = previousContext;
            this._responseStream = responseStream;
            this._responseWriter = responseWriter;

            IHttpSessionState container = new HttpSessionStateContainer(Guid.NewGuid().ToString(), new SessionStateItemCollection(), new HttpStaticObjectsCollection(), 20, true, HttpCookieMode.AutoDetect, SessionStateMode.InProc, false);
            this.SetSessionState(container);
        }