我可以在一个会员数据库下运行多个网站吗?
我正在尝试规划一系列共享许多资源的网站,例如 css/jscript/images/content 等。因此,我想在同一应用程序和 IIS 配置文件下运行所有网站,但具体取决于所使用的 URL 会更改母版页和主题/皮肤。
ASP.NET 成员数据库似乎是为了这个目标而设计的,因为它允许您设置多个应用程序,但我相信构建它的目的是允许应用程序在虚拟目录/文件夹下运行,而不是在虚拟目录/文件夹下运行。在单独的 URL 上。
是否可以将 url 映射到特定应用程序?
提前致谢 铝
I'm trying to plan a series of websites that all share many of the resources such as css/jscript/images/content etc. For this reason I wanted to run all of the websites under the same application and IIS profile, but depending on the URL being used change the masterpage and theme/skin.
The ASP.NET membership database seems as if it was designed with this goal in mind because it allows you to setup multiple applications, however I believe the purpose for which this was built was to allow applications to be run under virtual directories/folders, not on separate URLs.
Is it possible to map a url to a particular application?
Thanks in advance
Al
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,可以这样做。在您的配置中,使用您的提供程序的 applicationName。这样,所有数据都将保存在同一个数据库中,但通过您在大多数表中可以找到的应用程序 ID 分开。
共享资源的一种可能性是将它们仅放在一个位置,然后您可以通过使用第一个位置中文件的完整 URL 从其他站点指向该位置。
另一种可能性是将一个应用程序托管在同一域的虚拟目录中,尽管这样做可能会遇到 web.config 继承的一些有趣问题。如果您显示这两个应用程序的预期域名,将会有所帮助。
在一个应用程序中:
web.config 1:
在您的其他应用程序中:
网络配置2:
Yes it is possible to do this. In your configuration, use the applicationName for your providers. This way, all of the data will be saved in the same database, but kept separate by the Application Id that you will find in most of the tables.
One possibility for your shared resources can be to put them in just one location and you can point to that location from your other site by using a full url to the file in the first location.
Another possibility is to host one app in a virtual directory in the same domain, although you can get into some interesting issues with web.config inheritance doing this. It would help if you show your intended domain naming for the two applications.
In one application:
web.config 1:
In your other application:
web.config 2:
最简单的解决方案是根据页面正在执行的 URL 来包含样式表,使用:
IE(伪):
您需要找到一个函数来从 URL 中提取域名,这样它才能正常工作。
The easiest solution would be to include the style sheet depending on what URL the page is being executed on, using:
IE (pseudo):
You would need to find a function to extract the domain name from the URL so it works well.