Asp.net .Net SQL成员资格提供程序自定义提供程序属性
VS表示配置文件位于System.Web.Profile命名空间中。然后,我像这样使用它“System.Web.Profile.FirstName”,但却说System.Web.Profile.FirstName命名空间中不存在FirstName 如何设置属性并在以后检索它Asp.net .Net SQL成员资格提供程序自定义提供程序属性,asp.net,membership-provider,Asp.net,Membership Provider,VS表示配置文件位于System.Web.Profile命名空间中。然后,我像这样使用它“System.Web.Profile.FirstName”,但却说System.Web.Profile.FirstName命名空间中不存在FirstName 如何设置属性并在以后检索它 配置文件应该是一个属性,该属性具有基于System.Web.Profile.ProfileBase自动生成的类,该类包含您在Web.config文件中定义的成员。以下是msdn上的链接: 但是我记得我也有一个问题,文件不是由
配置文件应该是一个属性,该属性具有基于
System.Web.Profile.ProfileBase
自动生成的类,该类包含您在Web.config文件中定义的成员。以下是msdn上的链接:
但是我记得我也有一个问题,文件不是由VisualStudio生成的。我找到了一个WebProfile生成器,它是构建过程的扩展。这可能会对您有所帮助。为了获得对配置文件项的强类型访问,您需要使用诸如的工具
在网站项目中,Asp.net会自动创建强类型代理类,但不会在Web应用程序项目中自动创建它们。您可以执行以下操作: ProfileCommon p=(ProfileCommon)ProfileBase.Create(用户名,true) p、 FirstName=“FirstName” p、 Save() 如果用户已经有一个配置文件,create调用将返回现有的配置文件,否则它将创建一个新的配置文件
ProfileCommon是一个自动生成的类。你能再发布一点你的代码吗,特别是我想看看什么是
Profile
?使用VS2010是否会对使用WebProfileBuilder产生影响?我问是因为我运行了WebProfileBuilder。我在csproj中添加了导入项目行。当我打开解决方案并编译时,没有提示我正常加载项目。安装MSI和building项目是否会导致创建WebProfile类?没有看到任何创建的内容。设置/访问配置文件属性的代码是什么。这似乎没有设置它:System.Web.Profile.ProfileBase.Properties[“FirstName”].Name=((TextBox)RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl(“FirstName”)).Text;
<profile>
<providers>
<clear/>
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/>
</providers>
<properties>
<add name="FirstName"/>
<add name="LastName"/>
</properties>
</profile>
Profile.FirstName = ((TextBox)RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("FirstName")).Text;