0

私はasp.netWebアプリケーションに取り組んでいます。

asp.netでのURL書き換えについて教えてください:

以下のリンクを変更する必要があります

http://www.faredepot.com/ViewArticle.aspx?aid=1

http://www.faredepot.com/Cheap_Flights_to_Atlanta.html

どうすればこれを達成できますか?

void Application_BeginRequest(object sender, EventArgs e) {

        string fullOrigionalpath = Request.Url.ToString();

        if (fullOrigionalpath.Contains("http://www.faredepot.com/Cheap_Flights_to_Atlanta.html")) {
            Context.RewritePath("http://www.faredepot.com/ViewArticle.aspx?aid=1");
        }
    } 

またはweb.configでそれを行おうとしています

<rewriter>
    <rewrite url="http://www.faredepot.com/ViewArticle.aspx?aid=1" to="http://www.faredepot.com/Cheap_Flights_to_Atlanta.htm" />
</rewriter>  
4

1 に答える 1

1

ここにすべての可能な解決策の優れた内訳があります:http ://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx

どのバージョンのIISを使用していますか?IIS7の場合は独自のURL書き換えモジュールを使用し、II6の場合はIntelligencia UrlRewriter.NETを使用します:http://urlrewriter.net/

于 2012-06-08T10:49:24.817 に答える