RE: ASP/ASP.NET page that reacts a special way to items coming from a particular subdomain (programmatically testing subdomain?)
- From: stcheng@xxxxxxxxxxxxxxxxxxxx ("Steven Cheng")
- Date: Thu, 28 Feb 2008 12:03:51 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@xxxxxxxxxxxxxxxx>particular subdomain (programmatically testing subdomain?)
Subject: ASP/ASP.NET page that reacts a special way to items coming from a
Date: Wed, 27 Feb 2008 19:13:21 -0800
a
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
variable is set via querystring or in code. They render asrender
"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
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
.
- Follow-Ups:
- Prev by Date: Re: Error using Login control ASP.NET App_Data Folder
- Next by Date: Calling unix exe from web page
- Previous by thread: How can i compile a whole Webproject on a production server?
- Next by thread: Re: ASP/ASP.NET page that reacts a special way to items coming from a particular subdomain (programmatically testing subdomain?)
- Index(es):
Relevant Pages
|