Can I Have Multiple ASP.Net Web Sites in Same Solution? - asp.net

I have a website out there that I seem to keep wanting to add totally new things to each year. So when I go to www.MySite.com it does essentially one thing. So when I have a new idea for what is technically a totally different site, I do not want to have to come up with and then purchase a new domain name and hosting plan. I see in my hosting companies control panel that I can have multiple "application starting points." I have also read a bit about URL Rewriting. Not to mention, there is the setting of Virtual Path which I found when researching (Running aspnet web site starts on parent directory)
So my desire would be to have perhaps on solution with many projects (Web Apps) under it:
MySite
MySite Folder One
MySite Folder Two
MySite Bin
...
NewIdea
NewIdea Folder One
NewIdea Folder Two
NewIdea Bin (I suspect each project would of course have its own Bin folder)
...
Another Idea
Another Idea Folder One
Another Idea Folder Two
Another Idea Bin
...
I am fine with the users having to go to:
www.MySite.com
www.MySite.com/NewIdea
www.MySite.com/AnotherIdea
To get to each of these "sites" but technically each of them are totally independent and can change and be published separately as needed. Each has their own web.config of course.
Is this possible and how can I do it? I think I have all of the pieces, I just have not done nor tried it to know.

There's no reason you can't create different applications under your web site in IIS and then deploy different ASP.NET projects to the different applications. The different applications under your site can have different application pools, so you have that degree of isolation.
By default, your users would navigate to your different apps via:
MySite
MySite/App1
MySite/App2
This is probably what you're looking to do. Just create Applications (right click on your site in IIS and select "Add Application...") and then tweak as necessary.

Right click on the solution, click 'Set Startup Projects', and click the 'Start Multiple Projects' settings. Change the action for each project to whether you want to start, start with debugging or not start.

Not my kind of topic, but I suggest that this maybe helpful for you? Reading through they look rather similar, and gives you various options you can go through with and understand each more.
Best Practice for multiple asp.net web applications

Related

Host Four ASP.Net Projects in IIS as single direcory(maintain more projects in same url)

I m having a ASP.Net Webapplication it accessed by from many geography like India,China&America.In that application's login page fields are username,Password & Geography.
Based on this login page geography option the application's functionalities will change in all page.
In this project,If we add a feature for Indian users but that will not required for other geography users,So we use some conditions like if The geography is India means Enable the feature others means disable it.
problem here it is, in all pages we need to use so many conditions check,some time it creates conditions check overhead.
So we planing for divide the webappplication in to separate applications based on geography wise.
What I planing is,
In hosting environment
1.Keep the same project into Three(India,China,America) Subdirectories.
2.In root directory we have login page only .So once user select the geography means we need to redirect the corresponding subdirectory.
By this way we can maintain the changes which made based geography as separate.
But My doubt is...
If we keep the project as Three(India,China,America) Subdirectories means each directories are have same files ,bin and webconfig file,So I think we cant maintain more than one webconfig file in hosted ASP.Net application folder.
This Subdirectories idea is possible or not in IIS hosting environment?
Is any other options are available?
Experts please share your valuable ideas.
Thanks in Advance
Ramesh
Good afternoon Ramesh!
If I understand your question correctly you currently have 3 separate web roots and you want to use these as separate web applications that will be served to users based on geography in some way. You also want to maintain individual web configuration files for each as well. If this is your inquiry then this set-up is definitely possible within IIS 7 and above.
To provide this functionality this you can do the following:
Configure a single main site within the IIS. This site can point to a web root or nothing. If it points to a web root, whatever web.config that exists will be inherited by the web applications we will add in the next few steps. Otherwise, the machine.config will be used.
Add 3 separate web applications underneath this main site. Make sure to add the root path of each application to use the respective 3 paths for your web roots. The web applications will by default inherit web configurations from the main site as mentioned earlier, but you can include a separate web.config within each of these web root folders.

admin site as folder inside asp.net site

Now I'm working with ASP.NET (web forms) and Admin for this site is site itself, but located in folder inside existing site. I have some impression that it's not very good, for example if you publish external site with option "delete existing files", it deleted internal site. My question: is it okay if one site located inside another, or I should move it?
Let me paraphrase question: is it bad or good practice to have nested sites or nested projects?
I cannot give you an official answer.
Just as you don't feel right about it so do I.
Publishing websites in nested existing website folder is just not a good idea especially with admin site.
However if for some reason the Admin site has to be inside of the existing site, then it would make sense to make the admin site part of the existing site project so you just publish one project.
There is no right or wrong answer, so here is my two cents.
It is fine having another website inside a website as long as you can figure out the web.config. (Sometimes, inside web.configs collide with outside one)
It is fine as long as you are not hosting in Azure. The problem in Azure is you will have to put them in a same package.
Only draw back is as you said you cannot publish application straight from VS using delete existing files option.
Case Study
One of the popular open source shopping cart - nopcommerce have two separate Web Applications - Nop.Web and Nop.Admin.
It lets you place Admin site under Admin folder if you want Admin features.
I'm going to come out and say this is worth avoiding in general and moreover you can get the same outside effect (nested urls) without the hassles of having web configs inside of web configs.
What I would do is build separate sites and if I wanted things to appear to be nested I would use a reverse proxy (which can easily be IIS using ARR running on the same box) to front things and manage public urls.

Integrate multiple ASP.Net websites

I want to create a new website. The website has 3 applications, each one has its own membership/profile provider.
I want the user to be able to log in to the site with one single sign on.
Possible option AFAIK:
Define the same machinekeys/Connection Strings for all applications in their web.config files and I think I'm all set.
Does this work? And I'm curious to see if there's any other way.
Yeah, that is the path to go. Just make sure the config settings are identical and all three apps will work together just fine.
As a side: you say you want to build a new website with 3 applications. Are those "apps" separate sites or virtual directories of the top site? In other words, will they share the same URL?
The only issue I can think of is if the URL's are different then the session id's will also be different and therefore force the user to log in to each of them on access. This might be okay in your situation. With your method the credentials will be the same though.

Can you create folders to organize web sites in IIS7?

I have several ASP.NET sites in IIS7 and would like to be able to group them into folders (or other mechanism, if available). Ideally, I would use a customer name or account number and put the sites under there.
Is there a way to customize the organization of sites in IIS7, or is there just the one 'flat' view?
I'm open to tricks and hacks.
IIS7 (or any other version) does not have the concept of folders for sites. I would instead come up with a naming scheme that, on sorting the list of sites, makes it easier to find what you need.
One option will be to add multiple applications under one site if they are related and on same domain of course. You can also have each applicatoin associates to its own application pool.
For example,
www.example.com
www.example.com/admin
www.example.com/auth

Adding admin subdomain in asp.net

I have a website that i am hosting from home. I want to add a subdomain to my website, for example: admin.mywebsite.com Would it be best to create a new project and point DNS to that project, or should i rather create the admin application in a folder under the current project?
I don't think there is a 'best' option, certainly not one which is best in all circumstances.
Personally, I would have the admin bundled in with the main site as it will help you synchronise changes to your data access in your web application with changes in your admin system. When you deploy new versions, you know you are deploying an admin site and main site that work together. When you have two, you have two projects to maintain, two to deploy and you might find sharing code between the two a pain.
You may wish to keep the sites partitioned more strictly though so perhaps two sites is best for you. If you haven't got a compelling reason to have the separated, then don't otherwise you lose the benefits above.

Resources