473,811 Members | 4,039 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Programmaticall y create subdomains (host header records)

5 New Member
I implemented a URL rewriter which worked reasonably well, but now I am creating other sites on the same server (single IP). Because IIS will not accept subdomain wildcards (*.subdomain.co m), it resolves the subdomain traffic back to the default site (e.g. the site with empty host header). From there it is possible to rewrite and pass the traffic back to correct web app and use the referring agent to get original url, but this gets messy in practice.

So I am looking for way to programmaticall y create/remove the host header records for the subdomains. Is there any programmatic interface to IIS, or some file to plug the header values directly?

Thanks,
Lauren
Sep 29 '09 #1
7 4974
Frinavale
9,735 Recognized Expert Moderator Expert
What version of IIS are you using?

-Frinny
Sep 29 '09 #2
lmeyers
5 New Member
Using IIS v6

Thanks in advance for your help,
Lauren
Sep 29 '09 #3
Frinavale
9,735 Recognized Expert Moderator Expert
I'm not sure if this is going to help you but...this article on URL Rewriting in ASP.NET has a lot of information on the topic....

-Frinny
Sep 29 '09 #4
lmeyers
5 New Member
Yes i had looked at that when setting up the URL rewriting. Unfortunately it does not address rewriting URL for subdomains of site other than default.
Sep 29 '09 #5
JamieHowarth0
533 Recognized Expert Contributor
Hi lmeyers,

If you're creating subdomains on a single IP, can you explain why you need a wildcard on subdomains - do you plan on running one site on all subdomains on your site?

URL rewriting will be tricky to say the least, and until you can explain the background a little more, my recommendation is normally this: either just to use multiple sites, one IP, one host header on each for each subdomain if you plan on running single sites - or use one site, one IP, no host header so it catches all incoming traffic.

If you then want to do rewriting with the second option you have choices:
1) If your single site is running ASP.NET then you could write a URL rewriter as Frinny's link pointed to. I've had great success in this area, especially as ASP.NET now supports Regex and you can link it directly to database lookups too - especially useful for content management systems and advanced URL rewriting.
2) If you run multiple sites, single host header each, then Ionic ISAPI Rewriter is the tool for you. Supports Regex lookups, header modifications, 301/302s, all in a nice ISAPI that you can dump straight onto the individual website to rewrite its' URLs.
3) If you really want to go down the route of programmaticall y controlling the host headers on a single site, then check out the WMI IIS reference on MSDN which will give you all the class references and function calls necessary to create objects programmaticall y and then add/edit/remove host headers as necessary.

Hope this helps.

codegecko
Sep 30 '09 #6
lmeyers
5 New Member
Thanks that is helpful info. Situation is that I have multiple sites each of which requires dynamic subdomains. I am using the Intelligencia URL rewriter which worked fine with single site subdomains. I had the rewrite configuration contained within the web.config file and the site was setup with no undefined host header record (e.g. default IIS site). Now with a second site also supporting dynamic subdomains all those requests go back to default site and URL rewriter on second site never even sees the request.

Still do not understand why IIS will not support *.domain.com the way the DNS system does. In any case, I have ordered more IP addresses which I think will resolve this silly issue.

Thanks for your input.
Sep 30 '09 #7
JamieHowarth0
533 Recognized Expert Contributor
Aha, now I see the problem.
Internet Information Services' host header system doesn't recognise widlcards, you are quite right. The best way around this is to use a fresh, dedicated IP with no host header and point all the necessary subdomains to that IP.

codegecko
Oct 1 '09 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

9
3351
by: Jeff | last post by:
Is there a way to echo back a case sensitive $HTTP_HOST in PHP? For example if I type HostName.domain.com in my browser I want to return it exactly as it appears in the location part of the browser "HostName.domain.com" but it keeps returning a case insensitive result "hostname.domain.com".
4
3094
by: BentleyInc | last post by:
I'm trying to find a way to add a whildcard application mapping to aspnet_isapi.dll in IIS programmatically.... been looking into IIS administrator reference but didn't find the right function to use. The equivalent GUI steps would be, open IIS, select my application->properties, app configuration, in whildcard application mapping type the path to aspnet_isapi.dll. Thanks, Jingmei Li
3
9182
by: Codex Twin | last post by:
Hello apologies if this is the wrong newsgroup to be sending this to. Basically, I have an ASP.NET application that I am trying to force to use a proxy server settings. This can be done by accessing machine.config, but I do not have access to the client machine.config machine. Therefore every request made from this application must have these proxy server settings. But I am having problems writing the code for this.
4
2046
by: radiax | last post by:
Is there a way to associate or bind a subdomain to a tcp sockets under .net framework (vb.net / c#). I know ip address can be used when using sockets, but the problem is the ip address is shared among subdomains (limited ips supply). Iam looking for possible way to use subdomain.domain.com instead of ip address. Any inputs?? thanks
3
1772
by: Roshawn | last post by:
Hi, I'm attempting to create a web application and I'd like to use subdomains (my hosting provider allows this). However, I have a few questions regarding subdomains and ASP.NET: 1. How do I create a subdomain on my local machine (e.g. http://xxxxx.localhost/), if it's possible. 2. If I chose to use master pages in this application, would they work as expected?
1
6386
by: Superfreak3 | last post by:
We have a web application that will be installed as a virtual directory. It will either default to the Default Web Site or allow the choice of the site to which the vir. dir. will be installed, if more than one sites exist on the server. Now, what I would like to do is set the ASP.NET version to 2.0 if it defaults to an earlier version (more than one instance of the Framework is installed). I would like to be able to do this...
12
3069
by: Tina | last post by:
Our company domain, say, wombat.com needs to create several subdomains: support, training, and purchase are three of the subdomains needed. So when someone browses to //training.wombat.com they will be directed to the IP we have assigned. I have two questions: 1. how can I do this at design time? 2. how can I do this at run time from my asp.net code? Thanks,
1
3359
by: onequestion | last post by:
Hi friends.. Is it possible to find subdomains on a domain. Can someone help me? currently i'm using this code.. private static String GetSubDomain(URL url) { String host = url.getHost().toString();
9
7817
by: Josh | last post by:
I run a Joomla website and am familiar with php in some but not all aspects. Currently I am trying to find some solutions related to session handling. Am I correct in saying that "login" is kept in sessions? I can see active sessions in my mysql database, but is that the only place this information is stored? Sessions and cookies I know are related also, but how specifically (session info stored in cookies?)? Right now, when users...
0
9604
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10644
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10394
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10127
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9201
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7665
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5552
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4336
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3863
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.