by   April 10 2012   
One of the most time consuming processes is getting your 1.5 million link references over to your new .Net or php pages that you have just setup. Coming from ASP on IIS and going to another program style is not what we look forward to but it's something we have to do at times. This sample snipplet of code should give you a good idea of how to handle all your query based dynamic pages. Static redirects for pages can be made from another code sample I'll place online that was called Smart-iA 404 search. Google didn't like it but it worked like a charm making every 404 page a good page in the end. By the way, I searched and searched for a ASP.Net version of this and instead of assoicating .ASP Classic with .Net I didn't find a solution.

Redirect ASP to .Net on IIS 7 QueryString Style.

When you are ready to start moving pages over to your new code platform this code below might help you get things done faster. You'll need to put the full domain address before the / .

In this example code I'm redirecting from my community folder. Each static page in the community folder was also a forum, comment, help page. (Good old ASP Classic)

The way I had it setup was based on query identifier. The page template would load a comments section for gdyk and a forum style with a topic or forum indicator. It was modeled after the all in one page build project. (All in one page was a full ASP website with only one page that simulated thousands of pages. That was a fun project.)

Dim strQSID
If Len(Request.QueryString) <> 0 Then
    If Request.QueryString("abc") <> "" Then
        strQSID = Trim(Request.QueryString("abc"))
        strQSID = "ABC"&strQSID
        If Len(strQSID) > 10 Then
        strQSID = Left(strQSID,10)
        End If    
    ElseIf Request.QueryString("TOPIC") <> "" Then
        strQSID = Trim(Request.QueryString("TOPIC"))
        strQSID = "T"&strQSID
        If Len(strQSID) > 10 Then
        strQSID = Left(strQSID,10)
        End If
    ElseIf Request.QueryString("FORUM") <> "" Then
        strQSID = Trim(Request.QueryString("FORUM"))
        strQSID = "F"&strQSID
        If Len(strQSID) > 10 Then
        strQSID = Left(strQSID,10)
        End If
    ElseIf Request.QueryString("faq") <> "" Then
        strQSID = Trim(Request.QueryString("faq"))
        strQSID = "FAQ"&strQSID
        If Len(strQSID) > 10 Then
        strQSID = Left(strQSID,10)
        End If
    End If
End If


' The Left(strQSID,10) is in place to handle basic malformed querys.
' You could trim( and UCase( if you needed to handle input not controlled.
Select Case UCase(strQSID)

Case "T315"
Response.Status = "301 Moved Permanently" 
Response.AddHeader "Location", "/community/application-developers/xctm-project" 
Response.End 

Case "F225"
Response.Status = "301 Moved Permanently" 
Response.AddHeader "Location", "/search/tech-archives/teamview-v-4" 
Response.End 

Case "FAQ2"
Response.Status = "301 Moved Permanently" 
Response.AddHeader "Location", "/community/technicians-zone/submit-publications" 
Response.End 

Case "ABC1"
Response.Status = "301 Moved Permanently" 
Response.AddHeader "Location", "/search/tech-archives/ca-antivirus" 
Response.End 

Case "ABC2"
Response.Status = "301 Moved Permanently" 
Response.AddHeader "Location", "/community/do-it-yourself/my-virus-infection/my-first-virus/usb-device-viruses" 
Response.End 

Case Else
Response.Status = "301 Moved Permanently" 
Response.AddHeader "Location", "/community"
Response.End 

End Select

 

Don't forget that you need to include your full domain with http:// I removed that part from the redirect lines.

Now for those that are redirecting to another querystring setup you can use the 404 page code to pull the page name and add the query string. I'll post that up later.

Yes, there are other ways of skinning this cat and I bet yours is 10 times faster. :)

One of the most time consuming processes is getting your 1.5 million link references over to your new .Net or php pages that you have just setup. Coming from ASP on IIS and going to another program style is not what we look forward to but it's something we have to do at times. This sample snipplet of code should give you a good idea of how to handle all your query based dynamic pages. Static redirects for pages can be made from another code sample I'll place online that was called Smart-iA 404 search. Google didn't like it but it worked like a charm making every 404 page a good page in the end. By the way, I searched and searched for a ASP.Net version of this and instead of assoicating .ASP Classic with .Net I didn't find a solution.