Adding admin subdomain in asp.net - 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.

Related

How do i scale my solution to multiple domains on single web application

Im a little lost here. Im starting on a project for a customer who wants a SaaS solution as a small portal.
The idea is that i make a web solution e.g. an online business card, where each customer should have their own domain like this:
www.carpenter.com
www.painter.com
www.masonry.com
Etc. each of these domains should point to my web application and each have their own administration web site and the online business card. This means that if I go to: www.carpenter.com I should see the companys online business card. And at the url: www.carpenter.com/admin the carpenter company should be able to log in and edit its information.
I hope this makes sense.
What Im looking at is how this is done in practice, I would like to have a central database and a central place to update my software (maybe one per country). What do i need to do to point a www.carpenter.com domain/url to its own specific area in my web app. And how do I need to structure my web application to do this?
Im using ASP.NET MVC for this, but this should be a general question regardless of language - or?
Im considering using a cloud service such as Azure, is this possible with this setup? Or do i need a virtual hosted server i own myself?
I guess the main question is "how do I host multiple domains on the same software" - and keep the display of the "business card" and admin separated from each customer?
Not sure if this specifically answers your question, and my experience thus far has not been with ASP, but I think the general idea is that you determine the execution environment for your web app early in the bootstrap process, and then set constants and configuration options at that point. Then, you can use those values throughout your application to customise the response based on which site you're working with (i.e. carpetner, masonry, etc.). And, since the only piece of differentiating information you have during the bootstrap process is the domain name and URL of the site being requested, I think the generally accepted method is to switch on the domain name. So, you can store different configs for the different sites based on their domain names, and then load those configs during the bootstrap process. For example, if you had a different site template for your carpentry site and your masonry site, you could store the path to your templates as one of the configuration options. HTH

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.

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

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

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

Resources