string invalidLicensePath = "importlicenses"; string currentUrl = Request.Url.Segments[1]; if (currentUrl.ToLower() != invalidLicensePath) { //filterContext.Result = new RedirectResult(changePasswordPath); filterContext.Result = new RedirectResult(@"~/DataMaintenance/ImportLicenses"); }but when I was looking in the debugger it's actually Segments[3] in my case.