示例#1
0
        /// <summary>
        /// Forwards the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <param name="forwardUrl">The forward URL.</param>
        /// <param name="response">The response.</param>
        public static void Forward(this HttpRequest request, Uri forwardUrl, HttpResponse response)
        {
            // Setup forwarding request
            HttpWebRequest forwardRequest = request.GetForwardingRequest(forwardUrl);

            WebResponse forwardResponse = null;

            try
            {
                forwardResponse = forwardRequest.GetResponse();
            }
            catch (WebException e)
            {
                forwardResponse = e.Response;
            }

            CopyResponse(forwardResponse, response);
        }