View Single Post
  #1 (permalink)  
Old June 1st, 2007, 01:37 PM
jweyl11 jweyl11 is offline
Registered User
 
Join Date: May 2007
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default redirected users

Hi-

I am not sure if my title is correct, but here goes the situation. I am a noobie to ASP.NET so excuse me if I am stumped by the simple stuff.

Here is the situation. We have a list of URL's that are managed by the same DNS servers. If a user opens a browser and goes to http://www.mydomain.com or http://www.yourdomain.com (our URL's) they should be redirected to a default page based on the URL they came in from.

In my development environment this works, because of course I can control everything, but when we place it on the webserver for our hosting company I get a blank page. All of the URL's are stored in a SQL Server Table and a query is run against the table based on the incoming URL to fill out the default page dynamically.

Below is my code:
protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //get the profile for the incoming url
            String URL = Request.Url.Host.ToString();

            SqlConnection Conn = new SqlConnection(ConfigurationManager.AppSettings.Get ("DBConnection"));
            SqlCommand Cmd = new SqlCommand();
            Cmd.CommandType = CommandType.Text;
            Conn.Open();
            Cmd.Connection = Conn;
            Cmd.CommandText = "Select * from Profile where WebDNS = '" + URL + "'";

            SqlDataReader Reader = Cmd.ExecuteReader();


            //fill out the form from the data
            if (Reader.Read())
            {
                FirstNameLiteral.Text = Reader["FirstName"].ToString();
                LastNameLiteral.Text = Reader["LastName"].ToString();
                HiLiteral.Text = Reader["Description"].ToString();
                EmailLiteral.Text = Reader["Email"].ToString();
                VoiceMailLiteral.Text = Reader["LandPhone"].ToString();
                CellPhoneLiteral.Text = Reader["CellPhone"].ToString();
            }
    }



Any suggestions to fix this code would be appreciated.
Thanks,
Joe