配置profile来对匿名用户和认证用户的某些信息进行保存,当用户一段时间后登录,要保持这信息依然存在,需不需要通过aspnet_regsql来附加到数据库?谢谢

解决方案 »

  1.   

    他有默认的实现,如果使用默认的,就要用到aspnet_regsql。如果自己实现provider,就可以自己决定用不用aspnet_regsql。
      

  2.   

    楼主可以在配置文件中指定想要存储在哪个数据库中
    <configuration>
    <connectionStrings>
    <add
    name="myConnectionString"
    connectionString=
    "Server=MyServer;Trusted_Connection=true;database=MyDatabase" />
    </connectionStrings>
    <system.web>
    <anonymousIdentification enabled="true" />
    <profile defaultProvider="MyProfileProvider">
    <providers>
    <add
    name="MyProfileProvider"
    type="System.Web.Profile.SqlProfileProvider"
    connectionStringName="myConnectionString" />
    </providers>
    <properties>
    <add
    name="FirstName"
    allowAnonymous="true" />
    <add
    name="LastName"
    allowAnonymous="true" />
    </properties>
    </profile>
    </system.web>
    </configuration>类似这样profile配置中,包含了一个defaultProvider特性,这个特性指向一个叫MyProfileProvider的 profile provider,而这个provider定义是在profile标记的<providers>节中完成的。 MyProfileProvider则使用一个叫MyConnectionString的连接字符串完成数据库连接,并保存profile信息到数据库中
      

  3.   

    能不能说的详细点,我不是很了解这个,如果是用properties呢,这个用不用?谢谢了
      

  4.   

    如果是在页面上获取profile中的信息,再加上其它信息保存到自定义数据库,但又要保持用户每次打开页面时,profile中的信息依然存在
      

  5.   

    楼主可以看看http://ghd258.cnblogs.com/archive/2005/10/20/258434.html