Redirect subdomain to subfolder

Discussion in 'ASP.NET 2.0' started by edupa24, Jun 3, 2010.

  1. Hi!

    I'm having some trouble with this thing! I coded the master page with the redirect subdomain code, that's working just fine, but I need to redirect the subdomain to multiple files according to the user request.

    If InStr(UCase(Request.ServerVariables("SERVER_NAME")), UCase("revista.acorl.org.co")) > 0 Then
    Response.Redirect("/revista/")
    Else
    Response.Redirect("/Default.aspx")
    End If

    There's a database that contains a table with a colum that holds a URL to a specific file like http://www.mydomain/folder1/folder2/file.pdf, this string is stored from a CMS so I need it to be dynamic.

    So I need that when the user request the url from a HyperLink, the server redirects it to that specific folder according to the record in the database table.

    For example:

    The record says:
    http://subdomain.mydomain.com/folder1/folder2/file1.pdf

    I need to redirect to:
    http://www.mydomain.com/folder1/folder2/file1.pdf

    The other thing is that I can't update the record in the database because that's some kind of weird regulation from the goverment. The new records can be different, but the old ones must keep that url.

    Any guess?? I've been going arround this issue a lot, and I haven't found a solution, not even in google. Please help me!!
     

Share This Page