Last active
June 15, 2017 15:59
-
-
Save deeja/d9567bca09989b10ad3d9cde282c8c2f to your computer and use it in GitHub Desktop.
Route Table Entry viewer - Useful for viewing MVC routes that have been added to the RouteTable - Built for Sitecore
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
<%@ Page Language="C#" Debug="true" %> | |
<!DOCTYPE html> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head runat="server"> | |
<title>RouteTable entries</title> | |
<style> | |
table, th, td { | |
border: 1px solid black; | |
} | |
</style> | |
</head> | |
<body> | |
<!-- Author: deeja https://github.com/deeja --> | |
<h1>RouteTable entries</h1> | |
<form id="form1" runat="server"> | |
<div> | |
<table> | |
<tr> | |
<th>Url</th> | |
<th>Defaults</th> | |
<th>Contraints</th> | |
<th>DataTokens</th> | |
</tr> | |
<% foreach (var route in RouteTable.Routes.OfType<Route>()) | |
{ %> | |
<tr> | |
<td><%: route.Url %></td> | |
<td> | |
<% if (route.Constraints != null) {foreach (KeyValuePair<string, object> pair in route.Constraints) | |
{%> <%: pair.Key %>: <%: pair.Value %><br/> <%}} %> | |
</td> | |
<td> | |
<% if (route.Defaults != null) {foreach (KeyValuePair<string, object> pair in route.Defaults) | |
{%> <%: pair.Key %>: <%: pair.Value %><br/> <%} }%> | |
</td> | |
<td> | |
<% if (route.DataTokens != null) {foreach (KeyValuePair<string, object> pair in route.DataTokens) | |
{%> <%: pair.Key %>: <%: pair.Value %><br/> <%}} %> | |
</td> | |
</tr> | |
<% } %> | |
</table> | |
</div> | |
</form> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment