ASP/ASP.NET page that reacts a special way to items coming from a particular subdomain (programmatic

Discussion in 'ASP .Net' started by Ken Fine, Feb 28, 2008.

  1. Ken Fine

    Ken Fine Guest

    Please help me think through this one.

    1) I have DNS and IIS set up on my server.
    2) I've written ASP and ASP.NET webpages that behave in certain ways when a
    variable is set via querystring or in code. They render as
    "mobile-optimized" pages when they receive the right params via QS.
    3) I've configured subdomains on my server, e.g: mobile.mydomain.org
    4) What I want is for requests that come in on mobile.mydomain.org to render
    themselves as mobile pages.

    My choices:
    1) Best: Can I test programmatically in classic ASP/ASP.NET whether the
    requests are coming from my mobile.mydomain.org? Could you tell me how?
    2) Alternate: What would be the smartest way to do this in IIS -- maybe by
    configuring a new website and inspecting host headers? Any liabilities for
    existing sites?

    Any other tactics? Thanks for any guidance you can offer.

    -KF
    Ken Fine, Feb 28, 2008
    #1
    1. Advertising

  2. Ken Fine

    Steven Cheng Guest

    Hi KF,

    Regarding on this issue, seems the first thing you need to do is get the
    servername in url and parse it(to see whether it contains subdomain info).
    In classic or ASP.NET , there are different means to do this. The following
    two articles have mentioned some means such as using
    ServerVariables(available in both ASP and ASP.NET) or the Request.Url
    property(for ASP.NET):

    http://www.velocityreviews.com/forums/t98901-point-a-subdomain-to-a-subdirec
    tory.html

    http://www.velocityreviews.com/forums/t102142-subdomain-redirect-within-appl
    ication.html

    Also, as you said that you may want to display different kind of page
    depend on this info, I think for ASP.NET, you may consider developing a
    HttpModule which intercept the request(check the servername in path) and
    redirect the url:

    #INFO: ASP.NET HTTP Modules and HTTP Handlers Overview
    http://support.microsoft.com/kb/307985

    http://www.c-sharpcorner.com/UploadFile/hemantkathuria/ASPNetHttpModules1126
    2005004251AM/ASPNetHttpModules.aspx

    http://www.devx.com/dotnet/Article/6962/0/page/4

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead



    ==================================================

    Get notification to my posts through email? Please refer to
    http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
    ications.



    Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    where an initial response from the community or a Microsoft Support
    Engineer within 1 business day is acceptable. Please note that each follow
    up response may take approximately 2 business days as the support
    professional working with you may need further investigation to reach the
    most efficient resolution. The offering is not appropriate for situations
    that require urgent, real-time or phone-based interactions or complex
    project analysis and dump analysis issues. Issues of this nature are best
    handled working with a dedicated Microsoft Support Engineer by contacting
    Microsoft Customer Support Services (CSS) at
    http://msdn.microsoft.com/subscriptions/support/default.aspx.

    ==================================================


    This posting is provided "AS IS" with no warranties, and confers no rights.



    --------------------
    >From: "Ken Fine" <>
    >Subject: ASP/ASP.NET page that reacts a special way to items coming from a

    particular subdomain (programmatically testing subdomain?)
    >Date: Wed, 27 Feb 2008 19:13:21 -0800


    >
    >Please help me think through this one.
    >
    >1) I have DNS and IIS set up on my server.
    >2) I've written ASP and ASP.NET webpages that behave in certain ways when

    a
    >variable is set via querystring or in code. They render as
    >"mobile-optimized" pages when they receive the right params via QS.
    >3) I've configured subdomains on my server, e.g: mobile.mydomain.org
    >4) What I want is for requests that come in on mobile.mydomain.org to

    render
    >themselves as mobile pages.
    >
    >My choices:
    >1) Best: Can I test programmatically in classic ASP/ASP.NET whether the
    >requests are coming from my mobile.mydomain.org? Could you tell me how?
    >2) Alternate: What would be the smartest way to do this in IIS -- maybe by
    >configuring a new website and inspecting host headers? Any liabilities for
    >existing sites?
    >
    >Any other tactics? Thanks for any guidance you can offer.
    >
    >-KF
    >
    >
    Steven Cheng, Feb 28, 2008
    #2
    1. Advertising

  3. Ken Fine

    Ken Fine Guest

    Thanks Steven, exactly what I needed. Figured it was easy, but always
    interesting to find the hard way too. :)

    -KF

    ""Steven Cheng"" <> wrote in message
    news:...
    > Hi KF,
    >
    > Regarding on this issue, seems the first thing you need to do is get the
    > servername in url and parse it(to see whether it contains subdomain info).
    > In classic or ASP.NET , there are different means to do this. The
    > following
    > two articles have mentioned some means such as using
    > ServerVariables(available in both ASP and ASP.NET) or the Request.Url
    > property(for ASP.NET):
    >
    > http://www.velocityreviews.com/forums/t98901-point-a-subdomain-to-a-subdirec
    > tory.html
    >
    > http://www.velocityreviews.com/forums/t102142-subdomain-redirect-within-appl
    > ication.html
    >
    > Also, as you said that you may want to display different kind of page
    > depend on this info, I think for ASP.NET, you may consider developing a
    > HttpModule which intercept the request(check the servername in path) and
    > redirect the url:
    >
    > #INFO: ASP.NET HTTP Modules and HTTP Handlers Overview
    > http://support.microsoft.com/kb/307985
    >
    > http://www.c-sharpcorner.com/UploadFile/hemantkathuria/ASPNetHttpModules1126
    > 2005004251AM/ASPNetHttpModules.aspx
    >
    > http://www.devx.com/dotnet/Article/6962/0/page/4
    >
    > Sincerely,
    >
    > Steven Cheng
    >
    > Microsoft MSDN Online Support Lead
    >
    >
    >
    > ==================================================
    >
    > Get notification to my posts through email? Please refer to
    > http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
    > ications.
    >
    >
    >
    > Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    > where an initial response from the community or a Microsoft Support
    > Engineer within 1 business day is acceptable. Please note that each follow
    > up response may take approximately 2 business days as the support
    > professional working with you may need further investigation to reach the
    > most efficient resolution. The offering is not appropriate for situations
    > that require urgent, real-time or phone-based interactions or complex
    > project analysis and dump analysis issues. Issues of this nature are best
    > handled working with a dedicated Microsoft Support Engineer by contacting
    > Microsoft Customer Support Services (CSS) at
    > http://msdn.microsoft.com/subscriptions/support/default.aspx.
    >
    > ==================================================
    >
    >
    > This posting is provided "AS IS" with no warranties, and confers no
    > rights.
    >
    >
    >
    > --------------------
    >>From: "Ken Fine" <>
    >>Subject: ASP/ASP.NET page that reacts a special way to items coming from a

    > particular subdomain (programmatically testing subdomain?)
    >>Date: Wed, 27 Feb 2008 19:13:21 -0800

    >
    >>
    >>Please help me think through this one.
    >>
    >>1) I have DNS and IIS set up on my server.
    >>2) I've written ASP and ASP.NET webpages that behave in certain ways when

    > a
    >>variable is set via querystring or in code. They render as
    >>"mobile-optimized" pages when they receive the right params via QS.
    >>3) I've configured subdomains on my server, e.g: mobile.mydomain.org
    >>4) What I want is for requests that come in on mobile.mydomain.org to

    > render
    >>themselves as mobile pages.
    >>
    >>My choices:
    >>1) Best: Can I test programmatically in classic ASP/ASP.NET whether the
    >>requests are coming from my mobile.mydomain.org? Could you tell me how?
    >>2) Alternate: What would be the smartest way to do this in IIS -- maybe by
    >>configuring a new website and inspecting host headers? Any liabilities for
    >>existing sites?
    >>
    >>Any other tactics? Thanks for any guidance you can offer.
    >>
    >>-KF
    >>
    >>

    >
    Ken Fine, Feb 28, 2008
    #3
  4. Ken Fine

    Steven Cheng Guest

    You're welcome :)

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead


    This posting is provided "AS IS" with no warranties, and confers no rights.

    --------------------
    >From: "Ken Fine" <>
    >References: <>

    <>
    >In-Reply-To: <>
    >Subject: Re: ASP/ASP.NET page that reacts a special way to items coming

    from a particular subdomain (programmatically testing subdomain?)
    >Date: Thu, 28 Feb 2008 06:59:59 -0800
    >
    >Thanks Steven, exactly what I needed. Figured it was easy, but always
    >interesting to find the hard way too. :)
    >
    >-KF
    >
    >""Steven Cheng"" <> wrote in message
    >news:...
    >> Hi KF,
    >>
    >> Regarding on this issue, seems the first thing you need to do is get the
    >> servername in url and parse it(to see whether it contains subdomain

    info).
    >> In classic or ASP.NET , there are different means to do this. The
    >> following
    >> two articles have mentioned some means such as using
    >> ServerVariables(available in both ASP and ASP.NET) or the Request.Url
    >> property(for ASP.NET):
    >>
    >>

    http://www.velocityreviews.com/forums/t98901-point-a-subdomain-to-a-subdirec
    >> tory.html
    >>
    >>

    http://www.velocityreviews.com/forums/t102142-subdomain-redirect-within-appl
    >> ication.html
    >>
    >> Also, as you said that you may want to display different kind of page
    >> depend on this info, I think for ASP.NET, you may consider developing a
    >> HttpModule which intercept the request(check the servername in path) and
    >> redirect the url:
    >>
    >> #INFO: ASP.NET HTTP Modules and HTTP Handlers Overview
    >> http://support.microsoft.com/kb/307985
    >>
    >>

    http://www.c-sharpcorner.com/UploadFile/hemantkathuria/ASPNetHttpModules1126
    >> 2005004251AM/ASPNetHttpModules.aspx
    >>
    >> http://www.devx.com/dotnet/Article/6962/0/page/4
    >>
    >> Sincerely,
    >>
    >> Steven Cheng
    >>
    >> Microsoft MSDN Online Support Lead
    >>
    >>
    >>
    >> ==================================================
    >>
    >> Get notification to my posts through email? Please refer to
    >>

    http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
    >> ications.
    >>
    >>
    >>
    >> Note: The MSDN Managed Newsgroup support offering is for non-urgent

    issues
    >> where an initial response from the community or a Microsoft Support
    >> Engineer within 1 business day is acceptable. Please note that each

    follow
    >> up response may take approximately 2 business days as the support
    >> professional working with you may need further investigation to reach the
    >> most efficient resolution. The offering is not appropriate for situations
    >> that require urgent, real-time or phone-based interactions or complex
    >> project analysis and dump analysis issues. Issues of this nature are best
    >> handled working with a dedicated Microsoft Support Engineer by contacting
    >> Microsoft Customer Support Services (CSS) at
    >> http://msdn.microsoft.com/subscriptions/support/default.aspx.
    >>
    >> ==================================================
    >>
    >>
    >> This posting is provided "AS IS" with no warranties, and confers no
    >> rights.
    >>
    >>
    >>
    >> --------------------
    >>>From: "Ken Fine" <>
    >>>Subject: ASP/ASP.NET page that reacts a special way to items coming from

    a
    >> particular subdomain (programmatically testing subdomain?)
    >>>Date: Wed, 27 Feb 2008 19:13:21 -0800

    >>
    >>>
    >>>Please help me think through this one.
    >>>
    >>>1) I have DNS and IIS set up on my server.
    >>>2) I've written ASP and ASP.NET webpages that behave in certain ways when

    >> a
    >>>variable is set via querystring or in code. They render as
    >>>"mobile-optimized" pages when they receive the right params via QS.
    >>>3) I've configured subdomains on my server, e.g: mobile.mydomain.org
    >>>4) What I want is for requests that come in on mobile.mydomain.org to

    >> render
    >>>themselves as mobile pages.
    >>>
    >>>My choices:
    >>>1) Best: Can I test programmatically in classic ASP/ASP.NET whether the
    >>>requests are coming from my mobile.mydomain.org? Could you tell me how?
    >>>2) Alternate: What would be the smartest way to do this in IIS -- maybe

    by
    >>>configuring a new website and inspecting host headers? Any liabilities

    for
    >>>existing sites?
    >>>
    >>>Any other tactics? Thanks for any guidance you can offer.
    >>>
    >>>-KF
    >>>
    >>>

    >>

    >
    >
    Steven Cheng, Feb 29, 2008
    #4
    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. Mark Kamoski
    Replies:
    1
    Views:
    7,069
  2. bertin

    application subdomain Asp.net

    bertin, Nov 30, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    379
    bertin
    Nov 30, 2005
  3. Steve Holden

    PyCon is Coming! PyCon is Coming!

    Steve Holden, Jan 5, 2006, in forum: Python
    Replies:
    0
    Views:
    294
    Steve Holden
    Jan 5, 2006
  4. saify
    Replies:
    0
    Views:
    856
    saify
    Sep 28, 2009
  5. Pito Salas
    Replies:
    3
    Views:
    80
    Tim Hunter
    Aug 28, 2009
Loading...

Share This Page