我可以运行一个单一的会员数据库在多个网站? [英] Can I run multiple websites under a single membership database?

查看:92
本文介绍了我可以运行一个单一的会员数据库在多个网站?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想策划了一系列的网站,都有着很多的资源,如CSS / JScript中/图像/内容等。出于这个原因,我想相同的应用程序和IIS配置文件下运行的所有网站中,但根据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.

在ASP.NET会员数据库好像它在设计时考虑到这一目标,因为它允许您设置多个应用程序,但是,我相信此建造的目的是允许应用程序在虚拟目录中运行/文件夹,而不是单独的URL。

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.

是否有可能一个URL映射到一个特定的应用?

Is it possible to map a url to a particular application?

在此先感谢

Thanks in advance Al

推荐答案

是的,这是可以做到这一点。在您的配置,使用的applicationName你的供应商。通过这种方式,所有的数据将被应用标识,你会在大多数的表查找被保存在相同的数据库中,但保持独立。

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.

您的共享资源的一种可能性可以把它们只在一个位置,你可以从其他网站在第一的位置使用完整URL文件指向该位置。

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.

另一种可能性是举办一个应用程序在同一个域中的虚拟目录,虽然可以进入一些有趣的问题与web.config中继承这样做。如果你显示你的预期域命名这两个应用程序,这将有助于。

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.

在一个应用程序:
web.config中1:

In one application: web.config 1:

<roleManager enabled="true">
    <providers>
        <clear/>
        <add name="AspNetSqlRoleProvider" applicationName="/ApplicationOne"
            ...add other properties here as standard
     />
    </providers>
</roleManager>
<membership>
    <providers>
        <clear/>
        <add name="AspNetSqlMembershipProvider" applicationName="/ApplicationOne"
            ...add other properties here as standard
         />
    </providers>
</membership>

在您的其它应用:
web.config中2:

In your other application: web.config 2:

<roleManager enabled="true">
    <providers>
        <clear/>
        <add name="AspNetSqlRoleProvider" applicationName="/ApplicationTwo"
            ...add other properties here as standard
     />
    </providers>
</roleManager>
<membership>
    <providers>
        <clear/>
        <add name="AspNetSqlMembershipProvider" applicationName="/ApplicationTwo"
            ... add other properties here as standard
         />
    </providers>
</membership>

这篇关于我可以运行一个单一的会员数据库在多个网站?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆