2012-07-13 8 views
-1

저는 ASP.NET 웹 사이트 (VS 2010, Framework 4.0)에서 작업 중입니다.URL 다시 쓰기 C#

어떻게 C#을 사용하여 페이지의 URL을 다시 작성할 수 있습니까? 타사 도구를 사용할 수 있습니까? 아무도 이것에 나를 도울 수 있습니까?

+1

[확인] (http://msdn.microsoft.com/en-us/library/ms972974.aspx) – HariHaran

+1

noath from whathaveyoutried.com – Bisileesh

+0

web.config에 URL을 다시 쓰려고하지 않습니다. – Bisileesh

답변

1
void Application_BeginRequest(object sender, EventArgs e) 
{ 
    // Get the current path 
    string CurrentURL = Request.Url.ToString(); 
    // Condition 
    if (CurrentURL.Contains("HtmlResponce.aspx")) 
    { 
     HttpContext MyContext = HttpContext.Current; 

     // Re write here 
     MyContext.RewritePath("testPage.aspx"); 
    } 
} 

나는이 코드를 Global.asax에서 시도했다. 그것은 나를 위해 일한다!