Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old June 1st, 2007, 01:37 PM
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


  #2 (permalink)  
Old June 3rd, 2007, 06:32 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

This is the classic ASP area of the forum

Wind is your friend
Matt


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple Users SpyderSL Access 1 December 20th, 2006 08:40 AM
How many users.... rupen Classic ASP Basics 0 October 20th, 2006 08:45 AM
Directing users dungey Javascript 3 March 10th, 2004 05:43 AM
Netbean users ....please help me out pratheeba Servlets 1 November 26th, 2003 01:27 PM





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