public static GetLookupTable ( ) : Redirect>.Dictionary |
||
리턴 | Redirect>.Dictionary |
public bool TryFindContent(PublishedContentRequest request) { //Get the requested URL path + query var path = request.Uri.PathAndQuery.ToLower(); var fullpath = request.Uri.OriginalString.ToLower(); //Check the table var redirectLookupTable = RedirectRepository.GetLookupTable(); Redirect matchedRedirect; if (redirectLookupTable.TryGetValue(path, out matchedRedirect)) { // set the 301 redirect on the request and return request.SetRedirectPermanent(matchedRedirect.NewUrl); return(true); } if (redirectLookupTable.TryGetValue(fullpath, out matchedRedirect)) { // set the 301 redirect on the request and return request.SetRedirectPermanent(matchedRedirect.NewUrl); return(true); } //did not found one return(false); }
public bool TryFindContent(PublishedContentRequest request) { //Get the requested URL path + query var path = request.Uri.PathAndQuery.ToLower(); //Check the table var redirectLookupTable = RedirectRepository.GetLookupTable(); var matchedRedirect = redirectLookupTable.ContainsKey(path) ? redirectLookupTable[path] : null; if (matchedRedirect == null) { return(false); } //Found one, set the 301 redirect on the request and return request.SetRedirectPermanent(matchedRedirect.NewUrl); return(true); }