易截截图软件、单文件、免安装、纯绿色、仅160KB

如何使用ASP.NET Profile

Asp.Net中有一套与用户相关联的属性设置,可以通过在WebConfig里配置来直接使用,他的作用为
存储和使用唯一与用户对应的信息
展现个人化版本的Web应用程序
用户的唯一身份标识在再次访问时识别用户
Asp.Net Profile提供的跟用户相关的类型都是强类型
首先生成数据库脚本,使用Visual Studio 2005 命令提示,输入命令行aspnet_regsql -A p -sqlexportonly filename
-A:表明增加一个数据库
p:表明生成的是Profile的数据库
-sqlexportonly:表明是倒出sql脚本,用其他参数可以直接创建数据库,具体的说明可以参看aspnet_regsql的帮助说明
filename:保存的文件名和 路径 
现在数据库创建好了,里面有4张表aspnet_Application用来存储应用程序的相关类型,aspnet_Profile用来保存用户的属性信息,aspnet_SchemaVersion用来存储版本信息,aspnet_User用来保存用户信息。可以从这几张表可以看到,多个应用程序可以用同一个数据库来表示用户信息。
下面是如何来配置WebConfig来支持Profile
首先配置连接字符串
<connectionStrings>
<add name="ProfileDatabase" connectionString="Server=192.168.1.2; Initial Catalog=aspnetdb; User ID=sa; Password=sa"/>
</connectionStrings>
然后在system.web节点下添加profile节点
<profile enabled="true" automaticSaveEnabled="true" defaultProvider="SqlProvider">
<providers>
<clear />
<add name="SqlProvider"
type="System.Web.Profile.SqlProfileProvider"
connectionStringName="ProfileDatabase"
applicationName="ProfileSample"
description="Sample for ASP.NET profile and Profile Service" />
</providers>
<properties>
<add name="Name" type="System.String"/>
<add name="Email" type="System.String" />
<add name="Age" type="System.Int32" />
<group name="Address">
<add name="City" type="System.String" />
<add name="Street" type="System.String" />
<add name="PostalCode" type="System.String" />
</group>
</properties>
</profile>
测试成功的配置
<profile enabled="true" automaticSaveEnabled="true" defaultProvider="SqlProvider"  >
     
 


相关文档:

asp.net读取excl中的数据【转】

经常需要在数据库与Execl之间互导数据。net时代,ADO.NET可以使用使用Microsoft.Jet.OleDb访问访问Excel,网上已经有很多类似的资源,最典型也是最简单的可能如下:(asp.net环境)
 // 连接字符串           
        ......

ASP.NET页面间传值方法

一、目前在ASP.NET中页面传值共有这么几种方式:
1、表单提交,
   <form action= "target.aspx" method = "post" name = "form1">
<input name = "param1" value = "1111"/>
<input name = "param2" value = "2222"/>
   </form>
   ....
   for ......

asp.net页面刷新后的滚动条位置不变

只需在asp.net页面的Page指令中设置MaintainScrollPositionOnPostback="true"就可以轻松实现。
MaintainScrollPositionOnPostback属性的默认值为false。
另外asp.net的page对象还有一个SmartNavigator属性,这个属性我也试过。。好像对于css有影响。页面布局有点变化。。不是很好使 ......

ASP.NET中如何实现FORM认证登录

如何运用 Form 表单认证
ASP.NET 的安全认证,共有“Windows”“Form”“Passport”“None”四种验证模式。“Windows”与“None”没有起到保护的作用,不推荐使用;“Passport”我又没用过,唉……所以我只好讲讲“Form”认 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号