Subdomain redirection

Discussion in 'FrontPage' started by JustJo, Jan 28, 2009.

  1. I hope someone can help me. I am just learning how to use ASP with Visual Studio and I am having a lot of trouble trying to make a subdomain work. Until this day, aslong as a subdomain is added correctly into a server it works without anything to do from the user part (subdomain.domain.net)but with discountasp the story is different: I am told that in order for it to work I have to add a scriptto my default page, which can contain nothing but the script, and it's the script that will call the requested URL by any user.

    This is thescrip:

    The following is a sample script that you can use to redirect a subdomain. You will need to place it as default document on your document root.

    <%
    If InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("subdomain1.YourHostedDomainName.com") ) > 0 Then
    Response.Redirect("/subdomain1")
    ElseIf InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("subdomain2.YourHostedDomainName.com") ) > 0 Then
    Response.Redirect("/subdomain2")
    ElseIf InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("subdomain3.YourHostedDomainName.com") ) > 0 Then
    Response.Redirect("/subdomain3/home.asp")
    End If
    %>

    When I asked for help they told me they don't offer any help with scripts and I should try the forum.

    The original site is at a different server right now but I have to change because they don't offer ASP hosting and it's a must that I make the transition to asp.net, and I do have the subdomain working without any problem (very lousy design).

    I have copied everything to the new server and thetest website is at http://iphixnet000.web703.discountasp.net/The test subdomain is at http://iphixnet000.web703.discountasp.net/gl/The subdomain (when it finally goes online) should be gl.iphix.net but I can't make the change from one server to the other until I am totally sure it will work because most users call the subdomain URL in order to access it and it's quite busy

    Iknow you guys are experts and I am just trying to design and makethis website work and put it online, so I need someone's help!!

    My questions are:
    • Should the default page be default.aspx or can it be index.aspx?
    • Can the extension be .aspx or it must be .asp?
    • Does it go on the <head> part of the page?
    • How should I enclose the script? Would <script type="text/C#"></script> work?


    I am not sure if I make any sense, I would really appreciate any help I can get.


    Thanks a lot
     
  2. Bruce

    Bruce DiscountASP.NET Staff

    * Should the default page be default.aspx or can it be index.aspx?

    Yes. It depends on what you set the default document to be. By default, both should work/

    * Can the extension be .aspx or it must be .asp?

    I think both should work

    * Does it go on the <head> part of the page?

    Not sure i understand this q!!

    * How should I enclose the script? Would <script type='text/C#'></script> work?

    No. use <% %>

    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
  3. Thank you so much for replying, Bruce. My question about the <head> is because there is also the , or am I on the wrong page?

    Is there a way I can try the script before I change servers?My sitepage is at http://iphixnet000.web703.discountasp.net, how could I test it?

    Thanks!
     
  4. I'm having similar issues. I'm new to ASP.NET and what I want to do is as follows. Can someone let me know if this is the write course of action. Thanks

    Lets say my domain is www.domain.com and I have a simple asp.net 3.5 website in the root. I also have another website in a sub folder called "folder2".

    what I want is instead of going to www.mydomain.com/folder2 to access this website, I want to instead go to folder2.mydomain.com

    How do I do this? In C# context.

    Thanks
    Callon
     

Share This Page