1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

ASP Redirect help!

Discussion in 'C#' started by MsSuzie, Dec 1, 2007.

  1. #1
    I will admit right off the bat, i am NOT a programmer! But I am not stupid, I can usually figure things out. This, however has me stumped!

    i have a gig of web space.
    I have 3 different web URL's
    I created folder on the gig of space for each URL with an index.html page
    Each URL is a different web page.

    readyhosting told me I need to write an index.asp file to tell each website where to go. they gave me the following "example"

    After trying many many times to get it to work, I find out from readyhosting does not support custom asp files and the above was just an example and that more code is needed... :rolleyes:

    Can anyone help a poor girl out? I have requested books from the library, but books can't tell me what you experienced coders can!
    SEMrush
    Thanks!
     
    MsSuzie, Dec 1, 2007 IP
    SEMrush
  2. BuildHome

    BuildHome Well-Known Member

    Messages:
    837
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    108
    #2
    You must add "Case Else" in your select case after the last case.
    Good Luck :)
     
    BuildHome, Dec 1, 2007 IP
  3. MsSuzie

    MsSuzie Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thanks

    what about this code I just found.
    private void Page_Load(object sender, System.EventArgs e)
    {
    if(!IsPostBack)
    {
    string url = Request.Url.ToString().ToLower();
    string domain;
    // get just the domain name for the switch
    if ( url.StartsWith( "http://" ) )
    url = url.Substring( 7 );
    int x = url.IndexOf( '/' );
    if ( x > 0 )
    domain = url.Substring( 0, x );
    else domain = url;

    // redirect based on the domain name
    switch( domain )
    {
    case "www.myfantasticfranchise.com":
    case "myfantasticfranchise.com":
    Response.Redirect( "MFF/index.html", true );
    return;

    case "www.metoproductions.com":
    case "metoproductions.com":
    Response.Redirect( "MTP/index.html", true );
    return;

    case "www.aayt.tv":
    case "aayt.tv":
    Response.Redirect( "AAYT/index.html", true );
    return;
    }
    // unknown url
    Response.Write("<h2>You got here (" + domain + ") by error.<br>" );
    Response.Write( Request.Url.ToString() + "<br></h2>" );
     
    MsSuzie, Dec 1, 2007 IP
  4. MsSuzie

    MsSuzie Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    ok i tried what I just posted and I got an error message....
     
    MsSuzie, Dec 1, 2007 IP
  5. BuildHome

    BuildHome Well-Known Member

    Messages:
    837
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    108
    #5
    Why did you change your code? Why didn't you used my fixed code that I've wrote you?
     
    BuildHome, Dec 1, 2007 IP
  6. teraeon

    teraeon Peon

    Messages:
    40
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    The second bit of code you posted is asp.net. To get that to work you will need the .net framework. As far as your hosting, does it support ASP? If so then your first example should work if you save the file as default.asp.

    Most hosts however give you the ability to create multiple domains and they create the folders for you, so it's not just a domain pointer. Check if your host will allow that.
     
    teraeon, Dec 1, 2007 IP
  7. ashrafweb

    ashrafweb Member

    Messages:
    67
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #7
    ashrafweb, Dec 2, 2007 IP
  8. BuildHome

    BuildHome Well-Known Member

    Messages:
    837
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    108
    #8
    What? The code that I've fixed for you is wrriten in ASP Classic (ASP 3.0), not ASP.net.
     
    BuildHome, Dec 2, 2007 IP
  9. urstop

    urstop Peon

    Messages:
    224
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Yeah, you will have to write code to support redirections as ASP does not have support similar to what we get in php thru the .htaccess file.
     
    urstop, Dec 2, 2007 IP