p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Classic ASP Basics (http://p2p.wrox.com/forumdisplay.php?f=61)
-   -   redirected users (http://p2p.wrox.com/showthread.php?t=58642)

jweyl11 June 1st, 2007 01:37 PM

redirected users

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;
            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.

mat41 June 3rd, 2007 06:32 PM

This is the classic ASP area of the forum

Wind is your friend

All times are GMT -4. The time now is 01:38 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.