Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #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


Reply With Quote
  #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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 04:09 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.