如何在用户注册的ASP.NET网站管理工具中添加其他属性?

时间:2021-01-15 03:15:30

Hi I want to add additional attribute when a user is register through ASP.NET WebSite Administration Tool . By default when we register use from administration tool , it contain password , username , security answer etc. I want to add additional field like address in it . There is a way to doing it .

嗨,我想在用户通过ASP.NET WebSite管理工具注册时添加其他属性。默认情况下,当我们从管理工具注册使用时,它包含密码,用户名,安全答案等。我想在其中添加其他字段,如地址。有一种方法可以做到这一点。

Please suggest me usable link or sample code.

请建议我可用的链接或示例代码。

1 个解决方案

#1


1  

If I understand your question correctly, please try this:

如果我理解您的问题,请尝试以下方法:

in web.config:

<profile defaultProvider="SqlProfileProvider">
<providers>
<remove name="AspNetSqlProfileProvider"/>
<add name="SqlProfileProvider" type="System.Web.Profile.SqlProfileProvider"     connectionStringName="LocalSqlServer" />
</providers>
<properties>
<add name="Address" type="string"/>
<add name="Age" type="int32"/>
</properties>
</profile>

In codebehind:

Dim userProfile As ProfileBase
userProfile = ProfileBase.Create("desired user profile", True)
userProfile.SetPropertyValue("Address", "123 Avenue")
userProfile.SetPropertyValue("Age", 21)
userProfile.Save()

#1


1  

If I understand your question correctly, please try this:

如果我理解您的问题,请尝试以下方法:

in web.config:

<profile defaultProvider="SqlProfileProvider">
<providers>
<remove name="AspNetSqlProfileProvider"/>
<add name="SqlProfileProvider" type="System.Web.Profile.SqlProfileProvider"     connectionStringName="LocalSqlServer" />
</providers>
<properties>
<add name="Address" type="string"/>
<add name="Age" type="int32"/>
</properties>
</profile>

In codebehind:

Dim userProfile As ProfileBase
userProfile = ProfileBase.Create("desired user profile", True)
userProfile.SetPropertyValue("Address", "123 Avenue")
userProfile.SetPropertyValue("Age", 21)
userProfile.Save()