简体   繁体   中英

How to create a web application in .Net that generates a sub-domain URL for each user of the website at run time

Hello Technical People,

I am planning to create a Web Application using SaaS model .

For that, I want to develop application in such a way that the application should create a Unique sub-domain URL for each of the website user at run time like:

if the website is www.mydomain.com then it should create sub-domain URLs ie www.user1.mydomain.com for User1 and www.user2.mydomain.com for User2 and so on at run time.

The website will be created using .NET framework 4.0 & Sql server 2008 The hosting environment will be IIS 7.0.

About this i have some idea that i need to use URL rewriting with Wild Card domain facility activated on IIS 7.0 for the web application.

But, The actual process to activate Wild Card domain facility on IIS and the Piece of code to display user specific sub-domain url is not cleared to me.

An early response will be appreciated.

Cheers !!

I found an article explaining how to do this at http://www.dotnetexpertguide.com/2012/04/aspnet-iis-dns-records-sub-domain-on.html . I have not tried the instructions it contains but it may be worth a look.

Step 1: Take all the Binding info ie(ip address,hostname,application pool) from user.

Step 2: Check whether the websitename is already exist in your IIS, if Yes then you have to give a unique name.

Step 3: Create a new site in IIS with all the binding info.

I did the same task earlier with also create the new fresh database on every new site creation. For code here a Link how I accomplished

Detailed Article: How to add new website into IIS Programmatically using Asp.net C#

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM