in Facebook/WebApp/App_Start/DefaultRouteHandler.cs [18:55]
public IHttpHandler GetHttpHandler(RequestContext requestContext)
{
var filePath = requestContext.HttpContext.Request.AppRelativeCurrentExecutionFilePath;
if (filePath == "~/")
{
filePath = "~/index.cshtml";
}
else if (filePath == "~/preview/OnJobCreating")
{
filePath = "~/Views/NativeConnectorSetup.cshtml";
}
else
{
if (!filePath.StartsWith("~/views/", StringComparison.OrdinalIgnoreCase))
{
filePath = filePath.Insert(2, "Views/");
}
if (!filePath.EndsWith(".cshtml", StringComparison.OrdinalIgnoreCase))
{
filePath = filePath += ".cshtml";
}
}
IHttpHandler handler = WebPageHttpHandler.CreateFromVirtualPath(filePath); // returns NULL if .cshtml file wasn't found
if (handler == null)
{
requestContext.RouteData.DataTokens.Add("templateUrl", "/views/404");
handler = WebPageHttpHandler.CreateFromVirtualPath("~/views/Shared/Error.cshtml");
}
else
{
requestContext.RouteData.DataTokens.Add("templateUrl", filePath.Substring(1, filePath.Length - 8));
}
return handler;
}