I'm migrating a ASP classic site to ASP.net MVC.
Is there a way to redirect the old traffic to the new one?
Example: how to go from:
www.mydomain.com/viewpage.asp?pageid=1234
to:
www.mydomain.com/page/1234
I'm migrating a ASP classic site to ASP.net MVC.
Is there a way to redirect the old traffic to the new one?
Example: how to go from:
www.mydomain.com/viewpage.asp?pageid=1234
to:
www.mydomain.com/page/1234
It appears you may have to use response.redirect in the 404 error page and map the query string input to the required new page. Round about way but works
Researching the issue I found that the best way was to:
I ended up using #2 because it more simple for my project
Sub Application_BeginRequest(ByVal sender As Object, _
ByVal e As System.EventArgs)
Dim fullOriginalpath As String = Request.Url.ToString.ToLower
If (fullOriginalpath.Contains("/viewpage.asp?pageid=")) Then
Context.Response.StatusCode = 301 'issue a permanent redirect'
Context.Response.Redirect("/page/" + getPageIDFromPath(fullOriginalpath))
End If
End Sub
You could use Context.RewritePath
too, but it does not change the url in the client browser.