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

定义和使用ASP.NET Profile(附例)

1、双击一个数据源控件,将要存储profile的数据库作为数据源加入控件(这个步骤没什么用,只是为了方便大家用控件建立连接,这样不容易出错),建立好之后将design页面的数据源控件删除,你会发现在web.config里还是有一条连接语句,不要删除,我们下面将用到它,如: <connectionStrings>
  <add name="aspnetdbConnectionString" connectionString="Data Source=JAMESSHENG;Initial Catalog=aspnetdb;Integrated Security=True" providerName="System.Data.SqlClient"/>
 </connectionStrings>
2、定义Profile,在源码中加入
  <profile enabled="true" automaticSaveEnabled="true" defaultProvider="SqlProvider">
   <providers>
    <clear/>
    <add name="sqlProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="aspnetdbConnectionString" applicationName="ProfileSample" description="Sample for asp.net Profile and Profile Service"/>
   </providers>
   <properties>
    <add name="BackGroudColor" type="System.String" allowAnonymous="true"/>
   </properties>
  </profile>
  <anonymousIdentification enabled="true"/>
//defaultprovider指定默认配置文件提供程序的名称 
   automaticSaveEnabled指定用户配置文件是否在 ASP.NET 页执行结束时自动保存。如果为true,则用户配置文件在 ASP.NET 页执行结束时自动保存。
   providers(可选元素)定义配置文件提供程序的集合,它当中包含<add> :name = defaultProvider的值;type = System.Web.Profile.SqlProfileProvider是使用sql;connectionStringName = aspnetdbConnectionString使用上面连接中定义的连接字符串;
properties(必选的元素)定义用户配置文件属性和属性组的集合,它当中包含<add>:name=“BackGroudColor”定义Profile中的属性名称;type="System.String"字符串类型;allowAnonymous="true"定义是否保存匿名用户配置,如果在此处定义true,则在后面必须加入<anonymousIdentification>配置,设


相关文档:

通过避免下列10个常见ASP.NET缺陷使网站平稳运行


ASP.NET 成功的其中一个原因在于它降低了 Web 开发人员的门槛。即便您不是计算机科学博士也可以编写 ASP.NET 代码。我在工作中遇到的许多 ASP.NET 开发人员都是自学成材的,他们在编写 C# 或 Visual Basic® 之前都在编写 Microsoft® Excel® 电子表格。现在,他们在编写 Web 应用程序,总的来说,他们所做的工 ......

asp及asp.net的urlencode问题

我想在asp中加一个链接,指向asp.net网页,但asp.net的网址是经过HttpUtility.UrlEncode变形和HttpUtility.UrlDecode变回的,而asp的server.urlencode却产生不了和HttpUtility.UrlEncode一样的编码,请问有没有解决办法
补充:原来asp.net的是"web.aspx?str="+HttpUtility.UrlEncode(str)
和HttpUtility.UrlDecode(Requ ......

ASP.NET MVC2 学习笔记之URL路由

    新建一个默认的ASP.NET MVC2应用程序,系统会默认的生成包含基本功能的应用程序,查看这些生成的代码,可帮助我们理解ASP.NET MVC2。下面是对URL路由的理解,以备忘。
一、Global.asax.cs中的代码:
public class MvcApplication : System.Web.HttpApplication
    {
  &n ......

ASP.NET GridView的使用详解


这是要实现的功能:
第一步:拖入GridView控件 并且完成查询所有数据的方法 通过this.GridView1.DataSource 获取集合数据   GridView1.DataBind() 绑定数据
第二步:实现全选功能
1. 页面代码:
代码
 <asp:TemplateField HeaderText="全选">
       &nbs ......

如何使用ASP.NET Profile


Asp.Net中有一套与用户相关联的属性设置,可以通过在WebConfig里配置来直接使用,他的作用为
存储和使用唯一与用户对应的信息
展现个人化版本的Web应用程序
用户的唯一身份标识在再次访问时识别用户
Asp.Net Profile提供的跟用户相关的类型都是强类型
首先生成数据库脚本,使用Visual Studio 2005 命令提示,输入 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号