Example #1
0
 public void AddUrlRedirection(string url, string urlRedirection)
 {
     UrlRedirections.Add(url,
                         urlRedirection.StartsWith("/")
             ? urlRedirection
             : "/" + urlRedirection);
 }
Example #2
0
 private bool TryRedirectUrl(HttpListenerResponse response, string url, out string redirectedUrl)
 {
     if (UrlRedirections.TryGetValue(url, out redirectedUrl))
     {
         response.Redirect(redirectedUrl);
         response.Close();
         return(true);
     }
     else
     {
         redirectedUrl = url;
         return(false);
     }
 }