Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / February 2008

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ken Fine - 28 Feb 2008 03:13 GMT
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 - 28 Feb 2008 12:03 GMT
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" <kenfine@newsgroup.nospam>
>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.
>
[quoted text clipped - 16 lines]
>
>-KF
Ken Fine - 28 Feb 2008 14:59 GMT
Thanks Steven, exactly what I needed. Figured it was easy, but always
interesting to find the hard way too. :)

-KF

> Hi KF,
>
[quoted text clipped - 82 lines]
>>
>>-KF
Steven Cheng - 29 Feb 2008 05:35 GMT
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" <kenfine@newsgroup.nospam>
>References: <0397729B-9643-41D0-9AE5-149EC50D138E@microsoft.com>
<OhSACIgeIHA.1500@TK2MSFTNGHUB02.phx.gbl>
>In-Reply-To: <OhSACIgeIHA.1500@TK2MSFTNGHUB02.phx.gbl>
>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
>
[quoted text clipped - 12 lines]
>> 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
>>
[quoted text clipped - 5 lines]
>> #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
>>
[quoted text clipped - 9 lines]
>>
>> Get notification to my posts through email? Please refer to

http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
>> ications.
>>
[quoted text clipped - 43 lines]
>>>
>>>-KF

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.