Sharing web.config fies between sites - asp.net

Not being a server admin I was wondering, can two ASP.NET websites on the same server sharing a common database use identical web.config files? I am developing a separately-branded companion website for a company with multiple business groups. Both sites have their own URLs but are hosted on the same server and will both communicate with the same database. Since the one site is already setup and running I was hoping I could save time and reuse the web.config in the new site. Will this cause any conflicts with the RSA key and its related cyphervalues?
Thank you in advance.

The answer is NO. Each website must have it's own web.config in the root folder (at a minimum).

Related

Making SharePoint folder accessible over internet

I have a SharePoint document library on my intranet and I want o make this library accessible to users on internet. I know easier option is to just make the website internet facing but that is not possible for some reasons.
To workaround the thing I was thinking to map this document library to a folder on another server on intranet and make it a virtual directory; this server is internet facing and so the virtual directory can be accessed by the users.
Just wondering have any one got a better option or see any issues with this said approach?
Thank you!
You can extend the web application and essentially create an extranet web application that still require permissions. Then you can grant the external users access to either the site or that document library with unique permissions. Might be overkill but that could do it.

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.

Same .NET code files, different web sites/domains in IIS?

ASP.NET - IIS 6 - we currently have a public-facing site that has a domain mapped against it. We are going to add a new web site in IIS 6, with its own IP, its own SSL cert, and its own domain name on the same server as the original web site/domain.
Let's say I want c:\inetpub\wwwroot\example to be be served up to the two different sites, where each of the following URLs would load the same .NET code.
https://www.domainA.com/example
https://www.domainB.com
...I'm trying to not splinter my code, but I'm not sure if there are pitfalls with the above approach. Will that work?
Yes. I have had two separate sites / virtual directories pointing to the same physical directory on the server with one set of code.

Deploying DotNetNuke and separate ASP.NET Application together - Possible Issues?

I am making this in a proactive attempt to head off any potential problems which could arise from this. The situation is that we are developing an ASP.NET application for a client which will handle the online ordering from their customers. This application is going to be using the same database that their current WinForms application uses (no real issue here).
At the same time we are developing a new front-end website for them using DotNetNuke. The DotNetNuke app will simply be linking to the ASP.NET application for the customers to submit their orders (no need for them to communicate back and forth, etc.)
The plan is to host both applications on the same box at the client location. What I am looking for are potential problems or setup tips which would prevent possible conflict between the two apps (web.config conflicts, etc.) Is there a problem with having both hosted on the same location, how should IIS be set up, etc.?
If there are any external resources also available which could address this, please feel free to link them as well.
Option 1: Make all the apps separate virtual directories off of the root website. Then have the root document redirect you to the proper subdirectory for the default application for that website(DNN).
Option 2: (DotNetNuke in root, other site in subdirectory) There will be many issues with web.config inheritance if the new application is not built with DotNetNuke, but you can get around these by blocking inheritance of the root web.config. Basically you add the following to your root web.config(DNN) file.
<location path="." inheritInChildApplications="false">
<system.web></system.web>
</location>
Option 3: As Scott said, create seperate sites with differnt subdomains and link them together. You can setup a redirect so whatever.com/order sends a user to order.whatever.com.
Just an FYI, if you use
inheritInChildApplications in DNN 4.7-4.9.2 (haven't verified 5.0) you will run into ScriptManager errors, previous versions of DNN don't have the problem.
We host a DNN site for our corporate site on the same Windows 2003 server with a bunch of other sites (.NET 2.0, SugarCRM, and even some WordPress instances with PHP extensions in IIS). These sites are 'separate' websites, and not subwebs of the default site. It's a real melting pot, and it works well. We did create some separate app pools for the PHP, .NET 2.0, and .NET 3.0/5 sites to ensure that they did not foul each other.

Sharing authentication between IIS applications on same domain

I have an IIS website on www.example.com
and a virtual directory at www.example.com/demo/
How can I use the authentication cookie from www.example.com in my virtual directory?
You are looking for a Single Site Login solution. If the article I linked to doesn't help you, there's plenty more on google when you know what to search for ;)
The cookies are shared in the same domain, even shared between applications.
I have used the same cookie to share authentication between a Classic ASP app and a .net app without problems.
Just use the same rules to encrypt or store the cookie.
A solution would be to use integrated authentication. This way the user look up, and authentication authority used, will be the same accost all sites with the servers on the same domain. If you are using something like basic or kerberos authentication then your authentication will not pass between sites even on the same server and possibly between parts of the site that run under different threads, eg a different app pool.
Use session data in asp or cookies to share session information on the same site between pages. Cookies will work even if the virtual folders are shared in a different pool. Just code around the requirements of your virtual directory, in case its shared between multiple sites.
P.S. If you are already using cookies, just have the code in your virtual be the same as what you are using on the other pages.
What are the additional requirements for the virtual? Is it on the same server?

Resources