Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more: , +
I have to redirect some old pages to new page using ASP.NET without MVC

old page url: abc.com/how-to-301-permanent-redirect-in-asp-net/
new page url: abc.com/blog/301-permanent-redirect-in-asp-net/

I'd like to manage the old and new URLs in a redirect map file maybe a csv or xml.



The old website was using Wordpress CMS and for the new one I'm using simple Routing in Global.asax file

routes.MapPageRoute("blog", "blog/{blog_slug}/", "~/blog_detail.aspx");

What I have tried:

I have tried this code: Handling 301 Redirects in ASP.NET 3.5[^]

But as mentioned in the tutorial, it is not working for folder level pages created for seo. The number of pages are 250+ so it's not possible to put a default file and a folder for each of them. Any simpler way to achieve this? Can anyone help me in doing this?
Posted
Updated 8-Apr-19 5:01am
Comments
[no name] 8-Apr-19 10:49am    
You write code to move stuff around or translate or create lists. It's called migrating, converting, moving, redeploying ... After the first 1, 250 is the same as 2 or 3 or 4 or ...
F-ES Sitecore 8-Apr-19 11:29am    
Look at the IIS Rewrite module, it allows you to do pattern-based redirecting via config files.

1 solution

301 redirects in asp.net - Google Search[^]

In that search result, I went here:

Jeff Widmer's Blog - How to 301 Permanent Redirect in ASP.NET[^]

The first response might be appropriate in your case, but only you can determine that.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900