working with personalized host headers using ASP

Discussion in 'ASP General' started by Frogbèrt, Nov 24, 2003.

  1. Frogbèrt

    Frogbèrt Guest

    Config: Win2K, IIS5.0

    My solution requires that the host header sent to IIS be analyzed. I have
    set up a web site that responds to both www.domain.com and domain.com. In
    DNS, both a WWW and a * A record exist, so either www.domain.com or
    domain.com gets directed to the same web site. However, I wish for
    whatever.domain.com to point to the same web site and for my ASP page to
    analyze the URL to determine what (if any) was entered BEFORE domain.com. A
    VERY simple example would look like this:
    <begin example>
    TheVirtualServer=GetVirtualServer(Request.Something("URL"),".domain.com")
    If TheVirtualServer then
    Response.Write TheVirtualServer & " was entered"
    Else
    Response.Write "No virtual server name was supplied"
    End If

    Function GetVirtualServer(TheURLEntered, TheDomainToBeChecked)
    GetVirtualDomain=Left(TheURLEntered,Instr(1,TheURLEntered,
    TheDomainToBeChecked)-1)
    End Function
    <end example>

    Now a user entering "domain.com" as the url should get "No virtual server
    name was supplied", whereas a user entering "anything.domain.com" would see
    "anything was entered". The challenge: how to have a web server with
    www.domain.com and "domain.com" (and/or *.domain.com) as configured host
    header to handle ANY request ending in "domain.com" AND how to analyze the
    URL passed by the user?

    Thanks,
    Rob
     
    Frogbèrt, Nov 24, 2003
    #1
    1. Advertising

  2. Frogbèrt

    Frogbèrt Guest

    UPDATE: working with personalized host headers using ASP

    Regarding: if I configure a web site with NO host header, any URL that would
    point to an unspecified host header (regardles the domain) would be
    redirected to that website. I could write a handler on that website to
    redirect to the specific domain. However, configuring a website without a
    host header implies a security risk, as this leaves the server vulnerable to
    attacks by worms that approach an IP address directly. Is there a
    workaround?


    (Previous post included for clarity)
    "Frogbèrt" <> wrote in message
    news:3fc1e01c$0$20318$4all.nl...
    > Config: Win2K, IIS5.0
    >
    > My solution requires that the host header sent to IIS be analyzed. I have
    > set up a web site that responds to both www.domain.com and domain.com. In
    > DNS, both a WWW and a * A record exist, so either www.domain.com or
    > domain.com gets directed to the same web site. However, I wish for
    > whatever.domain.com to point to the same web site and for my ASP page to
    > analyze the URL to determine what (if any) was entered BEFORE domain.com.

    A
    > VERY simple example would look like this:
    > <begin example>
    > TheVirtualServer=GetVirtualServer(Request.Something("URL"),".domain.com")
    > If TheVirtualServer then
    > Response.Write TheVirtualServer & " was entered"
    > Else
    > Response.Write "No virtual server name was supplied"
    > End If
    >
    > Function GetVirtualServer(TheURLEntered, TheDomainToBeChecked)
    > GetVirtualDomain=Left(TheURLEntered,Instr(1,TheURLEntered,
    > TheDomainToBeChecked)-1)
    > End Function
    > <end example>
    >
    > Now a user entering "domain.com" as the url should get "No virtual server
    > name was supplied", whereas a user entering "anything.domain.com" would

    see
    > "anything was entered". The challenge: how to have a web server with
    > www.domain.com and "domain.com" (and/or *.domain.com) as configured host
    > header to handle ANY request ending in "domain.com" AND how to analyze the
    > URL passed by the user?
    >
    > Thanks,
    > Rob
    >
    >
     
    Frogbèrt, Nov 24, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Roberto López
    Replies:
    3
    Views:
    379
    Roberto López
    Aug 1, 2003
  2. Luis E Valencia

    build a personalized link on a datagrid

    Luis E Valencia, May 27, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    338
    Luis E Valencia
    May 27, 2004
  3. RedHair
    Replies:
    6
    Views:
    576
    RedHair
    Feb 3, 2006
  4. theBlindRef
    Replies:
    1
    Views:
    341
    Konstantinos Pantos
    Nov 21, 2006
  5. Replies:
    6
    Views:
    346
    John W. Kennedy
    Dec 8, 2006
Loading...

Share This Page