Esempio n. 1
0
        public void TransferRequest(string path, bool preserveForm, string method, NameValueCollection headers)
        {
            if (!HttpRuntime.UseIntegratedPipeline)
            {
                throw new PlatformNotSupportedException(System.Web.SR.GetString("Requires_Iis_Integrated_Mode"));
            }
            if (this._context == null)
            {
                throw new HttpException(System.Web.SR.GetString("Server_not_available"));
            }
            if (path == null)
            {
                throw new ArgumentNullException("path");
            }
            IIS7WorkerRequest workerRequest = this._context.WorkerRequest as IIS7WorkerRequest;
            HttpRequest       request       = this._context.Request;
            HttpResponse      response      = this._context.Response;

            if (workerRequest == null)
            {
                throw new HttpException(System.Web.SR.GetString("Server_not_available"));
            }
            path = response.RemoveAppPathModifier(path);
            string queryString = null;
            int    index       = path.IndexOf('?');

            if (index >= 0)
            {
                queryString = (index < (path.Length - 1)) ? path.Substring(index + 1) : string.Empty;
                path        = path.Substring(0, index);
            }
            if (!UrlPath.IsValidVirtualPathWithoutProtocol(path))
            {
                throw new ArgumentException(System.Web.SR.GetString("Invalid_path_for_child_request", new object[] { path }));
            }
            VirtualPath path2        = request.FilePathObject.Combine(VirtualPath.Create(path));
            bool        preserveUser = true;

            workerRequest.ScheduleExecuteUrl(path2.VirtualPathString, queryString, method, preserveForm, preserveForm ? request.EntityBody : null, headers, preserveUser);
            this._context.ApplicationInstance.EnsureReleaseState();
            this._context.ApplicationInstance.CompleteRequest();
        }