/// <summary> /// Execute the handler, and return an updated redirect /// </summary> /// <param name="redirect">The redirect.</param> /// <returns> /// The same redirect, which may have been updated /// </returns> /// <exception cref="System.ArgumentNullException">redirect</exception> /// <exception cref="System.NullReferenceException">redirect.DestinationUrl cannot be null</exception> public Redirect HandleRedirect(Redirect redirect) { if (redirect == null) { throw new ArgumentNullException("redirect"); } if (redirect.DestinationUrl == null) { throw new ArgumentException("redirect.DestinationUrl cannot be null"); } try { // Generate redirect headers and end this response to ensure they're followed switch (redirect.StatusCode) { case 301: new HttpStatus().MovedPermanently(redirect.DestinationUrl); break; case 303: new HttpStatus().SeeOther(redirect.DestinationUrl); break; } } catch (ThreadAbortException) { Thread.ResetAbort(); } return(redirect); }
/// <summary> /// Execute the handler, and return an updated redirect /// </summary> /// <param name="redirect">The redirect.</param> /// <returns> /// The same redirect, which may have been updated /// </returns> /// <exception cref="System.ArgumentNullException">redirect</exception> /// <exception cref="System.NullReferenceException">redirect.DestinationUrl cannot be null</exception> public Redirect HandleRedirect(Redirect redirect) { if (redirect == null) throw new ArgumentNullException("redirect"); if (redirect.DestinationUrl == null) throw new ArgumentException("redirect.DestinationUrl cannot be null"); if (!redirect.DestinationUrl.IsAbsoluteUri) { redirect.DestinationUrl = new Uri(redirect.RequestedUrl, redirect.DestinationUrl); } return redirect; }
/// <summary> /// Execute the handler, and return an updated redirect /// </summary> /// <param name="redirect">The redirect.</param> /// <returns> /// The same redirect, which may have been updated /// </returns> /// <exception cref="System.ArgumentNullException">redirect</exception> /// <exception cref="System.NullReferenceException"> /// redirect.RequestedUrl cannot be null /// or /// redirect.DestinationUrl cannot be null /// </exception> public Redirect HandleRedirect(Redirect redirect) { if (redirect == null) throw new ArgumentNullException("redirect"); if (redirect.RequestedUrl == null) throw new ArgumentException("redirect.RequestedUrl cannot be null"); if (redirect.DestinationUrl == null) throw new ArgumentException("redirect.DestinationUrl cannot be null"); // If the request had a querystring, and the redirect didn't change it, keep the original one if (String.IsNullOrEmpty(redirect.DestinationUrl.Query) && !String.IsNullOrEmpty(redirect.RequestedUrl.Query)) { redirect.DestinationUrl = new Uri(redirect.DestinationUrl + redirect.RequestedUrl.Query); } return redirect; }
/// <summary> /// Execute the handler, and return an updated redirect /// </summary> /// <param name="redirect">The redirect.</param> /// <returns> /// The same redirect, which may have been updated /// </returns> /// <exception cref="System.ArgumentNullException">redirect</exception> /// <exception cref="System.NullReferenceException">redirect.DestinationUrl cannot be null</exception> public Redirect HandleRedirect(Redirect redirect) { if (redirect == null) { throw new ArgumentNullException("redirect"); } if (redirect.DestinationUrl == null) { throw new ArgumentException("redirect.DestinationUrl cannot be null"); } if (!redirect.DestinationUrl.IsAbsoluteUri) { redirect.DestinationUrl = new Uri(redirect.RequestedUrl, redirect.DestinationUrl); } return(redirect); }
/// <summary> /// Execute the handler, and return an updated redirect /// </summary> /// <param name="redirect">The redirect.</param> /// <returns> /// The same redirect, which may have been updated /// </returns> /// <exception cref="System.ArgumentNullException">redirect</exception> /// <exception cref="System.NullReferenceException"> /// redirect.RequestedUrl cannot be null /// or /// redirect.DestinationUrl cannot be null /// </exception> public Redirect HandleRedirect(Redirect redirect) { if (redirect == null) { throw new ArgumentNullException("redirect"); } if (redirect.RequestedUrl == null) { throw new ArgumentException("redirect.RequestedUrl cannot be null"); } if (redirect.DestinationUrl == null) { throw new ArgumentException("redirect.DestinationUrl cannot be null"); } // If the request had a querystring, and the redirect didn't change it, keep the original one if (String.IsNullOrEmpty(redirect.DestinationUrl.Query) && !String.IsNullOrEmpty(redirect.RequestedUrl.Query)) { redirect.DestinationUrl = new Uri(redirect.DestinationUrl + redirect.RequestedUrl.Query); } return(redirect); }
/// <summary> /// Execute the handler, and return an updated redirect /// </summary> /// <param name="redirect">The redirect.</param> /// <returns> /// The same redirect, which may have been updated /// </returns> /// <exception cref="System.ArgumentNullException">redirect</exception> /// <exception cref="System.NullReferenceException">redirect.DestinationUrl cannot be null</exception> public Redirect HandleRedirect(Redirect redirect) { if (redirect == null) throw new ArgumentNullException("redirect"); if (redirect.DestinationUrl == null) throw new ArgumentException("redirect.DestinationUrl cannot be null"); try { // Generate redirect headers and end this response to ensure they're followed switch (redirect.StatusCode) { case 301: new HttpStatus().MovedPermanently(redirect.DestinationUrl); break; case 303: new HttpStatus().SeeOther(redirect.DestinationUrl); break; } } catch (ThreadAbortException) { Thread.ResetAbort(); } return redirect; }
/// <summary> /// Execute the handler, and return an updated redirect /// </summary> /// <param name="redirect">The redirect.</param> /// <returns> /// The same redirect, which may have been updated /// </returns> public Redirect HandleRedirect(Redirect redirect) { HttpContext.Current.Response.AppendHeader("X-ESCC-Redirect", redirect.RedirectId.ToString()); return redirect; }
/// <summary> /// Execute the handler, and return an updated redirect /// </summary> /// <param name="redirect">The redirect.</param> /// <returns> /// The same redirect, which may have been updated /// </returns> public Redirect HandleRedirect(Redirect redirect) { HttpContext.Current.Response.AppendHeader("X-ESCC-Redirect", redirect.RedirectId.ToString()); return(redirect); }