私は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>