How to nest ASP.NET websites - asp.net

Is it possible to nest one ASP.NET website within another, for example:
http://example.com is an application root
http://example.com/differentsite is also an application root
If it is possible, what should be stuck in the web.config file of the parent website to prevent it interfering with the child site?
Note: This is for .NET 4.0 shared IIS7 hosting
Thanks in advance

Right click on the nested folder is IIS manager and click on "Convert to Application". This way they can live together. If you want them to run in separate processes so they won't have the same Application Pool settings, Create another application pool and assign one of the sites to it.
BTW, if the site folders are nested, they don't have to always appear in IIS manager as nested. You can add application to the default web site (or create a new site) and point it to the nested folder.

Yes, you can nest web sites by making folder an application, or adding a virtual folder that points to another application.
You need access to manage IIS on the server to do that, though.

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.

Can I create virtual directory in AppHarbor?

I have a website currently on my local IIS (a separate website like "Default Web site"). I added an folder inside it and right clicked and did a "Convert to Application". This means now it is completely separate application which has it's own web.config and doesn't interfere with main web.config.
Can I achieve the same in AppHarbor?
You should probably run this as a separate application on AppHarbor. Please provide additional details on your use case if that's not a good solution for you.

Sub-Website in IIS - ASP.NET

I have a asp.net website in the IIS which is available on internet as www.xyz.com now I have been asked to prepare another website which will be accessed via www.xyz.com/abc.
For this, do I need to create a virtual directory under the website folder XYZ in IIS? or is there any other way to achieve this.
You need to make the subdirectory an IIS application.
Keep in mind that inner apps like yours will be inheriting configurations from the top-most web configuration, so be careful clearing those settings you don't want in the child applications.
Yes a virtual directory will work, however note that if abc is a full-blown app you will have to add it as an application not as a virtual directory

ASP.NET Website inside Webforms application?

We've inherited an ASP.NET website. We've already converted it to a web application for different reasons.
But there are 2 folders with 2 .aspx pages inside that do some really kludgy things (creates a new aspx file with its corresponding code behind and save it inside one of those folders).
So when the project was a simple website, that worked because the created pages on runtime were compiled at request. This is not applicable to a web application.
We don't have time to re-code those ugly pages and do it as it should. So, is there a way to have those 2 pages (and the generated-at-runtime ones) excluded from the project and inside a website that is compiled at request? What other alternatives could you think of?
You can multiple Web Applications on a single site by designating them as separate applications within separate Virtual Directories in IIS. For this, just create a new Virtual Directory in IIS, right-click and go to Properties. Under the "Virtual Directory" tab, click Create. This will designate that Virtual Directory as a separate application.
The end result will be that "mysite.dom/VirtualDirectory1" and "mysite.dom/VirtualDirectory2" will be separate applications that can even run under a different ASP.NET runtime.
EDIT TO ADD that the downside of this is that the two applications are completely separate and cannot share Session or Application information. This can be easily solved via a Database or some other data store.

One Website multiple Application pools

Does anybody know if its possible to have your website run on multiple separate application pools
Some Background
I am looking into start a shopping center style site. I intend to set up
100 folders, each folder on the site will be treated as a separate site.
http://www.MyShoppingCentre/JohnsMenswear
http://www.MyShoppingCentre/GerrysGardeningCenter
I would like to have JohnMenswear running in a separate application pool
to GerrysGardeningCenter even though they are both webpages under MyShoppingCentre
Any help gratefully appreciated
Yes, create "Applications" out of each sub folder. Than the application can have a separate application pool, the same will work for Virtual Directories. Alternately you could also set up sub-domains and map each one to a separate website.

Resources