Reputation: 6562
I have some routes in my ASP.NET MVC application that handle redirecting of old urls. The URL I'm redirecting is:
contentSpanishContentList.aspx
Here's the route:
routes.MapRoute("RedirectLegacyContent1",
"content{contentUri}.aspx",
new { controller = "Redirect", action = "Content", contentUri = string.Empty, contentId = 0 });
The problem is it comes up as not found. I figured out that the problem is (in bold) contentSpanish*Content*List.aspx. What should I do to make this route work with this case?
Upvotes: 0
Views: 109
Reputation: 105019
content
).GetRouteData
method. And if you're planning to only use this route for incoming requests (not generating any URLs in your views to point to any of these pages ie. using Url.Action
or Html.ActionLink
) then the easiest way would be to generate something like a RegExRoute
which would be easy to write and also easy to resolve these kind of requests.The fist one is simple, the second is universal.
Upvotes: 1
Reputation: 59001
Use Fiddler to look at what's happening. Is the 404 happening on the first request? Or is it happening after the redirect?
Install the RouteDebugger package and see what it tells you.
Upvotes: 1