PC Review


Reply
Thread Tools Rating: Thread Rating: 1 votes, 1.00 average.

ASP/ASP.NET page that reacts a special way to items coming from a particular subdomain (programmatically testing subdomain?)

 
 
Ken Fine
Guest
Posts: n/a
 
      28th Feb 2008
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

 
Reply With Quote
 
 
 
 
Steven Cheng
Guest
Posts: n/a
 
      28th Feb 2008
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/forum...-to-a-subdirec
tory.html

http://www.velocityreviews.com/forum...ct-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/UploadF...ttpModules1126
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/subscripti...ult.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/subscripti...t/default.aspx.

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


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



--------------------
>From: "Ken Fine" <(E-Mail Removed)>
>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
>
>


 
Reply With Quote
 
Ken Fine
Guest
Posts: n/a
 
      28th Feb 2008
Thanks Steven, exactly what I needed. Figured it was easy, but always
interesting to find the hard way too.

-KF

""Steven Cheng"" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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/forum...-to-a-subdirec
> tory.html
>
> http://www.velocityreviews.com/forum...ct-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/UploadF...ttpModules1126
> 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/subscripti...ult.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/subscripti...t/default.aspx.
>
> ==================================================
>
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
>
>
> --------------------
>>From: "Ken Fine" <(E-Mail Removed)>
>>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
>>
>>

>


 
Reply With Quote
 
Steven Cheng
Guest
Posts: n/a
 
      29th Feb 2008
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" <(E-Mail Removed)>
>References: <0397729B-9643-41D0-9AE5-(E-Mail Removed)>

<(E-Mail Removed)>
>In-Reply-To: <(E-Mail Removed)>
>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"" <(E-Mail Removed)> wrote in message
>news:(E-Mail Removed)...
>> 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/forum...-to-a-subdirec
>> tory.html
>>
>>

http://www.velocityreviews.com/forum...ct-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/UploadF...ttpModules1126
>> 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/subscripti...ult.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/subscripti...t/default.aspx.
>>
>> ==================================================
>>
>>
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>>
>>
>>
>> --------------------
>>>From: "Ken Fine" <(E-Mail Removed)>
>>>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
>>>
>>>

>>

>
>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
runtime error on page whenever accessed from a subdomain? Andy B Microsoft ASP .NET 9 19th Nov 2007 11:42 AM
subdomain? perspolis Microsoft ASP .NET 0 25th May 2005 09:07 AM
subdomain Jason Microsoft Frontpage 2 13th May 2004 11:40 AM
Subdomain Erhan Microsoft Windows 2000 DNS 1 8th Sep 2003 12:14 AM
DNS subdomain Atomax Microsoft Windows 2000 Advanced Server 0 24th Jul 2003 02:37 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:16 AM.