public static Uri GetRequestUrlFromContext()
        {
            ErrorUtilities.VerifyHttpContext();
            HttpContext context = HttpContext.Current;

            // We use Request.Url for the full path to the server, and modify it
            // with Request.RawUrl to capture both the cookieless session "directory" if it exists
            // and the original path in case URL rewriting is going on.  We don't want to be
            // fooled by URL rewriting because we're comparing the actual URL with what's in
            // the return_to parameter in some cases.
            // Response.ApplyAppPathModifier(builder.Path) would have worked for the cookieless
            // session, but not the URL rewriting problem.
            return(new Uri(context.Request.Url, context.Request.RawUrl));
        }
        public static NameValueCollection GetQueryOrFormFromContext()
        {
            ErrorUtilities.VerifyHttpContext();
            HttpRequest         request = HttpContext.Current.Request;
            NameValueCollection query;

            if (request.RequestType == "GET")
            {
                query = GetQueryFromContext();
            }
            else
            {
                query = request.Form;
            }
            return(query);
        }
        public static NameValueCollection GetQueryFromContext()
        {
            ErrorUtilities.VerifyHttpContext();

            HttpRequest request = HttpContext.Current.Request;

            // This request URL may have been rewritten by the host site.
            // For openid protocol purposes, we really need to look at
            // the original query parameters before any rewriting took place.
            if (request.Url.PathAndQuery == request.RawUrl)
            {
                // No rewriting has taken place.
                return(request.QueryString);
            }
            else
            {
                // Rewriting detected!  Recover the original request URI.
                return(HttpUtility.ParseQueryString(GetRequestUrlFromContext().Query));
            }
        }
Ejemplo n.º 4
0
        protected internal virtual HttpRequestInfo GetRequestFromContext()
        {
            ErrorUtilities.VerifyHttpContext();

            return(new HttpRequestInfo(HttpContext.Current.Request));
        }