2013-04-26 6 views
2

ASP.NET 응용 프로그램에서 라우팅을 사용하고 있습니다. 사용자가 어떤 잘못된 URL을 입력하면 내가 원하는 무엇ASP.NET 라우팅. 기본 페이지

, 그가

예를 pagenotfound.aspx로 리디렉션해야합니다

http://mysite/product/ //<- OK. Goes to all products 

http://mysite/product/ipad //<- OK. Goes to ipad product 

http://mysite/somerandomstuff/ //<- NOT OK!! This one should go to pagenotfound.aspx Now I`m getting error: 

Server Error in '/' Application. 
-------------------------------------------------------------------------------- 


The resource cannot be found. 

내 코드는 다음과 같습니다

//works ok 
routes.MapPageRoute(
    "products-all",    
    "product",    
    "~/products.aspx"); 

    //works ok 
routes.MapPageRoute(
    "products-category",    
    "product/{category}",    
    "~/product.aspx"); 

//does not work!!! 
routes.MapPageRoute(
    "pagenotfound",    
    "",   // <-- what should be here???? 
    "~/pagenotfound.aspx"); 

감사 당신

+1

어쩌면 이것이 바로 내가 필요한 도움의 http://stackoverflow.com/a/14586192/1236044 – jbl

답변

0

이 기사는 어떻게 pagenotfound를 구현하는 방법에 대해 자세히 설명합니다

custom page not found

+0

이 될 수 있습니다. 고맙습니다 – Augis