Last active
November 3, 2016 05:26
-
-
Save hgirish/9ff5c6143f36a8659621 to your computer and use it in GitHub Desktop.
RouteConfig for ignoring bot requests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class RouteConfig | |
{ | |
public static void RegisterRoutes(RouteCollection routes) | |
{ | |
routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); | |
routes.IgnoreRoute("{*vti_inf}", new { vti_inf = @"(.*/)?_vti_inf.html(/.*)?" }); | |
routes.IgnoreRoute("{*vti_rpc}", new { vti_rpc = @"(.*/)?_vti_rpc(/.*)?" }); | |
routes.IgnoreRoute("{*allphp}", new { allphp = @".*\.php(/.*)?" }); | |
routes.IgnoreRoute("{*allcgi}", new { allcgi = @".*\.cgi(/.*)?" }); | |
routes.IgnoreRoute("{*allaspx}", new { allaspx = @".*\.aspx(/.*)?" }); | |
routes.IgnoreRoute("{*favicons}", new { favicons = @".*favicon\.(ico|gif|png)(/.*)?" }); | |
routes.IgnoreRoute("{*allappleicon}", new { allappleicon = @"apple-touch-icon.*\.png(/.*)?" }); | |
routes.IgnoreRoute("ckfinder/{*pathInfo}"); | |
routes.IgnoreRoute("{*allsql}", new { allsql = @".*\.sql(/.*)?" }); | |
routes.IgnoreRoute("{*allwpinclude}", new { allwpinclude = @"wp-includes.*(/.*)?" }); | |
routes.MapRoute( | |
name: "Default", | |
url: "{controller}/{action}/{id}", | |
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment