i'm working on asp.net web application.
please guide me for url rewriting in asp.net:
i need to change below link
http://www.faredepot.com/ViewArticle.aspx?aid=1
to
http://www.faredepot.com/Cheap_Flights_to_Atlanta.html
how can i achieve this i tried like following
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");
}
}
or else trying to do it in web.config
<rewriter>
<rewrite url="http://www.faredepot.com/ViewArticle.aspx?aid=1" to="http://www.faredepot.com/Cheap_Flights_to_Atlanta.htm" />
</rewriter>
You have an excellent breakdown of all the possible solutions here: http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx
Which version of IIS are you using? For IIS7 use its own URL Rewrite Module, and for II6 use Intelligencia UrlRewriter.NET: http://urlrewriter.net/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.