为什么CreateUserWizard控件会自动添加ASPNETDB.MDF数据库? [英] Why CreateUserWizard Control automatically adds the ASPNETDB.MDF database?

查看:731
本文介绍了为什么CreateUserWizard控件会自动添加ASPNETDB.MDF数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只希望使用CreateUserWizard控件来收集用户信息,并插入到我的自定义数据库。我不想用Asp.Net会员。

I only want to use CreateUserWizard Control to collect information from the user and insert into my custom database. I don't want to use Asp.Net Membership .

当我将此设置添加到Web.config
<会员和GT;
     <供应商>
        <清/>
     < /供应商>
< /会员>

When I add this setting to the web.config <membership> <providers> <clear /> </providers> </membership>

下面的错误来
必须指定默认的成员资格提供程序。

而当我删除从web.config此设置。页面成功运行,但CreateUserWizard控件会自动将ASPNETDB.MDF数据库到App_Data文件夹。

And when I remove this setting from the web.config. The page runs successfully BUT createUserWizard Control automatically adds the ASPNETDB.MDF database to the App_Data folder.

问:我们可以使用的CreateUserWizard自定义数据库与出使用ASPNETDB或asp.net成员

Question: Can we use CreateUserWizard with custom database with out using ASPNETDB or asp.net membership ?

推荐答案

CreateUserWizard控件提供了与您的网站的用户数据存储在创建数据存储新用户帐户传达的MembershipProvider对象的用户界面。对CreateUserWizard依赖的MembershipProvider创建用户,如果需要(参 MSDN )。

The CreateUserWizard control provides the user interface for the MembershipProvider object that communicates with your Web site's user data store to create new user accounts in the data store. The CreateUserWizard relies on the MembershipProvider to create the user and disable them if necessary (cf. msdn).

所以,你必须,如果你可以使用CreateUserWizard使用成员资格提供。

So you have to use a Membership Provider if you use the CreateUserWizard.

如果你不想使用标准的成员资格提供程序,你应该考虑创建的自定义成员资格提供

If you do not want to use the standard Membership Provider, you should consider creating a Custom Membership Provider.

不过,从你的问题,为什么你不希望使用标准的会员,目前尚不清楚。可能这是值得看的可能性,包括标准模式成员到自己的数据库,并保存自己很多工作(更不用提可能的安全问题等)使用的是在asp.net中已经实现的授权功能。 这里你可以找到如何把会员架构进入相同的数据库应用程序数据。

But from your question it is not clear why you do not want to use the standard Membership. May be it is worth to look at the possibility to include the standard Membership schema into your own database and save yourself a lot of work (not to mention possible security issues etc.) using the authorisation functionality which is already implemented in asp.net. Here you can find how to put the Membership schema into the same database as the application data.

更新:

如果你仍然想prevent从创建由会员提供手段的用户CreateUserWizard控件的CREATEUSER一步,你可以尝试处理CreatingUser事件及其LoginCancelEventArgs.Cancel属性设置为true。

If you still want to prevent the CreateUserWizard's CreateUser step from creating the user by means of Membership Provider, you can try to handle the CreatingUser event and set its LoginCancelEventArgs.Cancel property to true.

举例code:

protected void RegisterUser_CreatingUser(object sender, LoginCancelEventArgs e) 
{
 e.Cancel = true; 
} 

然后才能移动到下一个页面,你需要处理NextButtonClick事件精灵:

Then in order to move to the next page in the wizard you need to handle NextButtonClick event:


  1. 添加e.Cancel = FALSE;

  2. 添加CreateUserWizard.ActiveStepIndex =(你的向导的下一步
    指数);

之后,你将需要手动创建用户,例如在FinishButtonClick事件处理程序。

After that you will need to create the user manually, e.g. in FinishButtonClick event handler.

希望它帮助。

这篇关于为什么CreateUserWizard控件会自动添加ASPNETDB.MDF数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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