public void ProcessRequest(HttpContext context) { var request = context.Request; if (!IsRoutedRequest(request) || context.Response.ContentType == null || !context.Response.ContentType.Equals("text/html", StringComparison.OrdinalIgnoreCase)) { return; } context.Response.Write(@" <style> #mvc_rscan_loading { width: 100%; background-color: #000; color: red; padding: 10px; text-align: center; } #mvc_rscan_loading h2 { color: red; padding: 0px; margin: 0px;} #mvc_rscan { width: 100%; background-color: #fff; } #mvc_rscan .rowA { background-color: #fff; } #mvc_rscan .rowB { background-color: #c0c0c0; } #mvc_rscan .red { color: red; } #mvc_rscan .green { color: green; } #mvc_rscan h3 { padding: 0px; margin: 0px; } #mvc_rscan .tableTitle { text-align: center; color: #000; } </style> <div id='mvc_rscan_loading'> <h2>mvc.rscan is analyzing your site ...</h2> </div> "); var clientScript = new System.Web.UI.Page().ClientScript; var head = String.Join("\n", new string[] { String.Format( @"<script src=""{0}"" type=""text/javascript""></script>" , clientScript.GetWebResourceUrl(typeof(mvc.rscan.Reflector), "mvc.rscan.Resources.jquery-1.7.min.js")) ,String.Format( @"<script src=""{0}"" type=""text/javascript""></script>" , clientScript.GetWebResourceUrl(typeof(mvc.rscan.Reflector), "mvc.rscan.Resources.jquery-ui-1.8.17.custom.min.js")) ,String.Format( @"<link href=""{0}"" rel=""stylesheet"" type=""text/css"" />" , clientScript.GetWebResourceUrl(typeof(mvc.rscan.Reflector), "mvc.rscan.Resources.jquery-ui-1.8.17.custom.css")) }); // route table List<string> formattedDictionaryRoutes = new List<string>(); int rowNum = 1; List<Route> definedDictionaryRoutes = RouteTable.Routes.Where(x => x.GetType() == typeof(Route)).Cast<Route>().ToList(); foreach (Route r in definedDictionaryRoutes) { formattedDictionaryRoutes.Add(String.Format( @"<tr class='{0}'><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td><td>{5}</td></tr>" , rowNum % 2 == 0 ? "rowA" : "rowB" , r.GetHashCode() , r.Url , FormatDictionary(r.Defaults) , FormatDictionary(r.Constraints) , FormatDictionary(r.DataTokens))); rowNum++; } // controller action table var reflectedControllerActions = new Reflector().ScanCurrentAppDomain(); List<string> formattedControllerActions = new List<string>(); rowNum = 1; foreach (var r in reflectedControllerActions) { formattedControllerActions.Add(String.Format( @"<tr class='{0}'><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td><td>{5}</td><td>{6}</td><td>{7}</td><td>{8}</td><td>{9}</td></tr>" , rowNum % 2 == 0 ? "rowA" : "rowB" , r.HttpVerbs.ToString() , r.RequiresAuth ? "<span class=\"green\">Yes</span>" : "<span class=\"red\">No</span>" , String.Join(",", r.AuthRoles) , String.Join(",", r.AuthUsers) , r.Area , r.HttpControllerName , r.Method.Name , String.Join(",", r.Parameters.Select(x => String.Format("{0} ({1})", x.Name, x.ParameterType))) , r.Controller.Assembly.GetName().Name)); rowNum++; } var requestVectors = new RequestGenerator().GenerateRequestVectors(reflectedControllerActions, definedDictionaryRoutes); List<string> formattedRequestVectors = new List<string>(); rowNum = 1; foreach (var r in requestVectors.OrderBy(x => x.URL)) { formattedRequestVectors.Add(String.Format("<tr class='{0}'> <td>{1}</td> <td>{2}</td> <td>{3}</td> <td>{4}</td> <td>{5}</td> <td>{6}</td> <td>{7}</td> <td>{8}</td> <td>{9}</td> </tr>" , rowNum % 2 == 0 ? "rowA" : "rowB" , r.ControllerAction.HttpVerbs.ToString() , r.ControllerAction.RequiresAuth ? "<span class=\"green\">Yes</span>" : "<span class=\"red\">No</span>" , String.Join(",", r.ControllerAction.AuthRoles) , String.Join(",", r.ControllerAction.AuthUsers) , r.URL , r.ControllerAction.HttpControllerName , r.ControllerAction.Method.Name , r.DictionaryRoute.Url , FormatDictionary(r.DictionaryRoute.Defaults) )); rowNum++; } // context.Response.Clear(); context.Response.Write(String.Format(htmlFormat, head, String.Join("\n", formattedDictionaryRoutes), String.Join("\n", formattedControllerActions) , String.Join("\n", formattedRequestVectors))); }