Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / October 2007

Tip: Looking for answers? Try searching our database.

How to: Response Redirct to the Friendly URLs

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Showjumper - 11 Oct 2007 18:49 GMT
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] - 11 Oct 2007 20:12 GMT
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>");
}
Signature

Recursion: see Recursion
site:  http://www.eggheadcafe.com
unBlog:  http://petesbloggerama.blogspot.com
BlogMetaFinder:    http://www.blogmetafinder.com

> I have set up an HttpModule that creates friendly urls and utilizes
> RewritePath. Such a url looks like
[quoted text clipped - 8 lines]
> Thanks
> Ashok Padmanabhan DVM

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.