제목으로 라우팅을 구현했지만 정상적으로 작동하지만 CSS js 및 jpg 파일의 경로가 잘못되었습니다.Aps.Net 4.0 웹 양식 라우팅이 작동하지만 CSS jpg js 파일을 피하지 않습니다.
나는 도서관 System.Web.Routing
을 포함 그리고 내가로 시작하는 Global.asax에보다
<a href="search/shoes/" title="" > <img class="BorderHyperLinkImmagine" src="img/b5.jpg" alt="" /></a>
를 쓴 마크 업에 home.aspx에서 Web.config를 올바르게
<compilation debug="true" strict="false" explicit="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</assemblies>
</compilation>
시작에 나타납니다 CSS와 나는 모든 로컬 링크 (jpg, css, js)에 내 브라우저의 dev 도구에서 404 오류가 발생하여 라우팅을 발생시킵니다.
http://mysyte.com/search/shoese/style.css
의
istead :
http://mysyte.com/style.css
당신이 거기에 몇 가지 주석 행은 내가 그들 모두를 시도했지만 내가 같은 결과를 얻을 볼 수 있듯이, 잘못된 경로 (404). 두 곳 모두 home.aspx
및 lookupfortype.aspx
의 브라우저에서와 같이
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
'added for redirect and rewriting URL
Me.RegisterRoutes(RouteTable.Routes)
End Sub
'added for redirect and rewriting URL
Sub RegisterRoutes(ByVal routeCollection As RouteCollection)
'RouteTable.Routes.RouteExistingFiles = False
routeCollection.Ignore("{resource}.css/{*pathInfo}")
routeCollection.Ignore("{resource}.axd/{*pathInfo}")
'routeCollection.Ignore("{*allcss}", New With {.allcss = ".*\.css(/.*)?"})
'routeCollection.Ignore("{*alljpg}", New With {.alljpg = ".*\.jpg(/.*)?"})
'routeCollection.Add(New Route("*\.css", New StopRoutingHandler()))
'routeCollection.Ignore("{folder}/{*pathInfo}", New With {.folder = "css"})
routeCollection.MapPageRoute("RouteForpage", "search/{type}/", "~/lookupfortype.aspx")
End Sub
URL이 정확합니다. 나는 내가있는 문제를 해결