좋아, 마침내 알아 냈어. 저는 이것을 언젠가 다른 누군가에게 도움이되기를 희망하면서 이것을 간단한 형태로 설명하려고 노력할 것입니다.
기억해야 할 몇 가지 사항은 먼저 MVC가 아닌 앱인 순수 웹 폼입니다. 이제, Web.config의에서, 항목이 추가 될 필요가
void RegisterRoutes(RouteCollection routes)
{
routes.Add(new Route("{resource}.axd/{*pathInfo}", new StopRoutingHandler()));
routes.Add(new Route("{service}.asmx/{*pathInfo}", new StopRoutingHandler()));
routes.Add(new Route("*.psd/{*pathinfo}", new StopRoutingHandler()));
routes.Add(new Route("*.js/{*pathinfo}", new StopRoutingHandler()));
routes.Add(new Route("*.jpg/{*pathinfo}", new StopRoutingHandler()));
routes.Add(new Route("*.gif/{*pathinfo}", new StopRoutingHandler()));
routes.Add(new Route("{resource}.css/{*pathinfo}", new StopRoutingHandler()));
routes.RouteExistingFiles = false;
Data.DataContext context = new Data.DataContext();
var AppRoutes = (from r in context.SomeRouteTable
select r).ToList();
foreach (var AppRoute in AppRoutes)
{
routes.MapPageRoute(AppRoute.RouteName,
AppRoute.RouteUrl,
AppRoute.PhysicalFile, false);
// The important part is the "false" above. It is the
// CheckPhysicalUrlAccess parameter.
}
}
:의 내부 위해 Application_Start 무효에
<location path="landing"><system.web><authorization><allow users="*"/></authorization></system.web></location>
내 Global.ascx에서
는 방법이있다 Global.asax 파일은 단순히 RegisterRoutes 함수를 호출합니다.
this.RegisterRoutes(RouteTable.Routes);
서버를 다시 시작하고 완료합니다. 이제 로그인 페이지의 경로가 작동하지만 다른 모든 경로는 안전합니다. 다른 경로를 노출해야하는 경우 allow system = "*"으로 system.web 인증 섹션에 경로의 기본 경로를 추가하면됩니다.
다른 점은 자바 스크립트 (js), 이미지 (psd, jpg, gif), 실제로 경로 처리기의 정적 파일을 모두 가져갈 수 있다는 것입니다. 웹 전체에서 .axd와 .asmx가 설명되었지만 웹폼 모델에서 라우팅을 처리 할 때 다른 정적 파일 유형에 대해이 작업을 무시하는 방법을 찾지 못했습니다.
다른 사람들에게 도움이되기를 바랍니다. 그리고이 모든 것을 추적하고 자신을 테스트하는 모든 시간을 보냈던 시간을 절약 할 수 있기를 바랍니다.
여러분을 즐기십시오.
해결 방법 현재로서는 Request.QueryString [ "ReturlUrl"] 값을 평가하고 일부 작업을 수행하지만 이는 좋지 않습니다. 그러나 솔루션을 찾을 때까지 작업을 완료 할 수 있습니다. 아직 아이디어가 열려 있습니다 ... – jakmas