I have thousands of links
which need to be redirect
to new URL
using 301 Permanent Redirect
. I have all these urls
in the Database table. I would like to know where should be these URLs should be loaded (only once). And can be used for 301 permanent redirect.
Sample URLs:
*RequestForURL* *301Redirect*
why-me/onboard-experience/food-and-drink-for-all-tastes/family-casual/-> /why-me/family-test/
why-me/onboard-experience/food-and-drink-for-all-tastes/room-service/-> /why-me/onboard-experience/food-for-all-tastes/
why-me/onboard-experience/food-and-drink-for-all-tastes/specialist-restaurants/-> /why-me/onboard-experience/food-for-all-tastes/
why-me/onboard-experience/food-for-all-tastes/me-deals/-> /why-me/onboard-experience/
why-me/onboard-experience/food-for-all-tastes/me-deals/wowsale2013.aspx /why-me/onboard-experience/
why-me/onboard-experience/food-for-all-tastes/dining-packages/-> /why-me/onboard-experience/food-for-all-tastes/
why-me/onboard-experience/food-for-all-tastes/drinks-packages/-> /why-me/onboard-experience/dazzling-entertainment/drink-packages/
why-me/onboard-experience/food-for-all-tastes/family-casual/-> /why-me/onboard-experience/food-for-all-tastes/
why-me/onboard-experience/food-for-all-tastes/room-service/ /why-me/onboard-experience/food-for-all-tastes/
why-me/onboard-experience/food-for-all-tastes/speciality-dining/-> /why-me/onboard-experience/food-for-all-tastes/
why-me/onboard-experience/types-of-me/-> /why-me/onboard-experience/
I am using VS 2013 Framework 4.0
NOTE: Data must be loaded once only into Session or during first application request.
Load the values from the database in
Application_Start
into a staticDictionary<string, string>
, then check the requested URL inBeginRequest
to see if it's key exists in a redirect dictionary, then docontext.Response.RedirectPermanent(value)
if it does.