사용자가 좀더 URL을 쉽게 이해할 수 있도록 해준다.

사용자가 /Products/Books.aspx 이렇게 치고 들어오면 아래와 같이

빽단에서 다시 URL 을 재작성 해서 보내준다.

 

   void Application_BeginRequest(object sender, EventArgs e) {

        string fullOrigionalpath = Request.Url.ToString();
        
        if (fullOrigionalpath.Contains("/Products/Books.aspx")) {
            Context.RewritePath("/Products.aspx?Category=Books");
        }
        else if (fullOrigionalpath.Contains("/Products/DVDs.aspx")) {
            Context.RewritePath("/Products.aspx?Category=DVDs");
        }
    }  

 

자세한 내용은  ScottGu’s 에서 ㄱㄱ

http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx

+ Recent posts