URL Redirecting problem

Discussion in 'ASP.NET 2.0' started by helpdesk, Feb 28, 2009.

  1. Hi All,

    We have a domain www.emsce.org pointing to the root folder emsce0000, also we have a sub domain beta.emsce.org pointing to a folder inside the root folder(\emsce0000\beta). We have written a script that which is redirecting to the sub domain

    if (Request.ServerVariables['SERVER_NAME'] == 'beta.emsce.org')
    {
    \\redirect to folder beta
    }
    else if (Request.ServerVariables['SERVER_NAME'] == 'emsce.org')
    {
    \\redirect to root folder
    }

    Both of these are working correctly. Now I wanted to have a separate section for administrative puposes for that I am going to use the url http://beta.emsce.org/master and i have created a folder master inside the beta folder and put all the necessary files in that folder. Please note that http://beta.emsce.org/master is not a sub domain . I have added a new section in the redirecting script

    else if (Request.ServerVariables['SERVER_NAME'] == 'beta.emsce.org/master')
    {
    \\redirect to beta\master
    }

    What is happening now is, when I type http://beta.emsce.org/master on the browser it is showing 'The page cannot be found' and when I type http://beta.emsce.org/beta/master it is redirecting to the correct location. But I wanted the page should come when I use the url http://beta.emsce.org/master
    Could you please help me to solve this? It is urgent.
     
  2. Bruce

    Bruce DiscountASP.NET Staff

    Your logic is incorrect.

    Request.ServerVariables['SERVER_NAME'] only returns the hostname, eg. 'beta.emsce.org'. The path to the script should be available within this var, Request.ServerVariables['URL'].

    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     

Share This Page