public void AddUrlRedirection(string url, string urlRedirection) { UrlRedirections.Add(url, urlRedirection.StartsWith("/") ? urlRedirection : "/" + urlRedirection); }
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); } }