Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to: Response Redirct to the Friendly URLs

0 views
Skip to first unread message

Showjumper

unread,
Oct 11, 2007, 1:49:35 PM10/11/07
to
I have set up an HttpModule that creates friendly urls and utilizes
RewritePath. Such a url looks like
/articles/The-Article-Title-Goes-Here.aspx. I onlu recently added the
httpmodule so many of the search engines still have links that point to urls
with querystrings - /articles/displayarticle.aspx?ArticleID=10 for example.
What i want to do is redirect from this latter url to the newer user
friendly url. Any ideas. So far my attempts with and HttpModule for
redirecting have failed i FireFox i get the dreaded The Page Is not
redirecting properly message.

Thanks
Ashok Padmanabhan DVM


Peter Bromberg [C# MVP]

unread,
Oct 11, 2007, 3:12:00 PM10/11/07
to
You could try something along this line:
// usage: SafeRedir("http://my-friendly-url");

void SafeRedir(string URL)
{
Response.Buffer = true;
Response.Status = "302 Object moved";
Response.AddHeader( "Location", URL );
Response.Write ("<HTML><Head>");
Response.Write ( "<META HTTP-EQUIV=Refresh CONTENT=\"0;URL=" + URL + "\">");
Response.Write ( "<Script>window.location='" + URL + "';</Script>" );
Response.Write("</Head>");
Response.Write ("<Body> This page was moved <A Href=\"" + URL +
"\">here</A>");
Response.Write("</HTML>");
}
--
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com

0 new messages