how to share resources between multiple website?
I have three different websites that uses so开发者_如何学运维me base classes, usercontrols. And my questions here is that it possible to share these resources between this sites from single physical location? And also want to use single web.config for all three sites. As this will give me much more ease on maintenance issues.
So, if the above scenario is possible than how to achieve it.
You can share the resouce between the website by Creating DLL of your project and put that DLL in GAC
The Global Assembly Cache or GAC is a machine-wide .NET assemblies cache for Microsoft's CLR platform. The approach of having a specially controlled central repository addresses the shared library concept and helps to avoid pitfalls of other solutions that lead to drawbacks like DLL hell.
Deatils about GAC on WIKI
For Configuration Data
as per the concepts Web.Config file is private for each web site if you want to share the configuration data than make use of machine.Config file which is having data common for all website running on the machine
You could use the probing path config setting to define a location for each app where they can find the shared assemblies. That would mean you wouldn't need to strongly name the assemblies & store them in the GAC (although that is probably the best approach)
If you want to share config across the apps, you'll probably need to create some alternate config system. as @pranay said a web.config is private to the app. if the 3 apps are on the same server & share a common root (eg /apps/app1, /apps/app2, /apps/app3) you can put the config in the parent config.
精彩评论