注册 登录
编程论坛 ASP.NET技术论坛

我照入门经典创建个性化配置 做不出来

zhengyingcan 发布于 2011-11-10 19:08, 695 次点击
书上说先在 web.config文件里添加 如下代码
  <connectionStrings/>
   
  <system.web>
  <!--  
  设置 compilation debug="true" 可将调试符号插入
  已编译的页面中。但由于这会  
  影响性能,因此只在开发过程中将此值  
  设置为 true。
  -->
  <profile>
  <properties>
  <add name="Country"/>
  <add name="Visits" type="System.Int32" defaultValue="0"/>
  <add name="LastVisit" type="System.DateTime"/>
  </properties>
  </profile>
  <compilation debug="false">

再创建一个WEB页面,添加三个标签,在load事件下面添加如下代码:
 protected void Page_Load(object sender, EventArgs e)
  {
LabelLastVisit.Text=Profile.lastVisit.ToLongTimestring();
LabelVisitCount.Text=Profile.Visite.Tostring();
labelSelectedCountry.Text=Profile.Country;

实际上以上的 Profile.的代码是我硬写上去的,输入时候,不会自己跳出来, 是不是我漏using 什么了,
书上没有介绍,请大家指点一下,谢谢.
1 回复
#2
zhengyingcan2011-11-11 07:49
我也是看入门经典的,赋上书的照片
只有本站会员才能查看附件,请 登录
只有本站会员才能查看附件,请 登录
只有本站会员才能查看附件,请 登录
1