private void Init(HttpRequest request, HttpResponse response) { _request = request; _response = response; _utcTimestamp = DateTime.UtcNow; _principalContainer = this; if (_wr is IIS7WorkerRequest) { _isIntegratedPipeline = true; } if (!(_wr is System.Web.SessionState.StateHttpWorkerRequest)) CookielessHelper.RemoveCookielessValuesFromPath(); // This ensures that the cookieless-helper is initialized and // rewrites the path if the URI contains cookieless form-auth ticket, session-id, etc. Profiler p = HttpRuntime.Profile; if (p != null && p.IsEnabled) _topTraceContext = new TraceContext(this); // rewrite path in order to remove "/eurl.axd/guid", if it was // added to the URL by aspnet_filter.dll. string eurl = GetEurl(); if (!String.IsNullOrEmpty(eurl)) { string path = request.Path; int idxStartEurl = path.Length - eurl.Length; bool hasTrailingSlash = (path[path.Length - 1] == '/'); if (hasTrailingSlash) { idxStartEurl--; } if (idxStartEurl >= 0 && StringUtil.Equals(path, idxStartEurl, eurl, 0, eurl.Length)) { // restore original URL int originalUrlLen = idxStartEurl; if (hasTrailingSlash) { originalUrlLen++; } string originalUrl = path.Substring(0, originalUrlLen); // Dev10 835901: We don't call HttpContext.RewritePath(path) because the // original path may contain '?' encoded as %3F, and RewritePath // would interpret what follows as the query string. So instead, we // clear ConfigurationPath and call InternalRewritePath directly. ConfigurationPath = null; Request.InternalRewritePath(VirtualPath.Create(originalUrl), null, true); } } }
private void SwitchPrincipalContainer(IPrincipalContainer newPrincipalContainer) { if (newPrincipalContainer == null) { newPrincipalContainer = this; } // Ensure new container contains the current principal IPrincipal currentPrincipal = _principalContainer.Principal; newPrincipalContainer.Principal = currentPrincipal; _principalContainer = newPrincipalContainer; }