asp.net >Profile保存登陆信息

1.创建profile数据库

  A.打开:Visual Studio 命令提示cmd . 

  B.执行:aspnet_regsql  -A p -sqlexportonly pro.sql 命令

  C.然后在SQL 管理器中执行pro.sql脚本。

2.配置web.config  

<system.web>
     <profile enabled="true" automaticSaveEnabled="true" defaultProvider="AspNetSqlProfileProvider">
            <providers>
                <clear/>
                <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" 
            connectionStringName
="ProfileDatabase" <!--ProfileDatabase 数据库连接字符串名称-->
            applicationName
="/"/> </providers> <properties> <add name="Name" type="System.String"/> <add name="Age" type="System.Int32"/> <add name="Email" type="System.String"/> <group name="Address"> <add name="City" type="System.String"/> <add name="Street" type="System.String"/> <add name="PostlCode" type="System.String"/> </group> </properties> </profile>

3. 然后在页面中可能通过

  Profile对象进行访问或赋值(如:Profile.Name='xxx';)

     

原文地址:https://www.cnblogs.com/you000/p/2820607.html