日期:2014-05-18  浏览次数:20444 次

如何在web application中运用Profile 的问题?
我想在web application中运用Profile,我下载了一个补丁并且安装好后,终于可以在匿名情况下使用Profile.但是我按照msdn上(msdn的例子是web site)上的步骤执行当匿名用户登陆后能够取回未登陆时的设置去出现了问题;
msdn(ms-help://MS.MSDNQTR.v80.en/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_vwdcon/html/3847984b-858a-4d43-b565-f10fa86b6bcc.htm) 

我的web.config的配置如下: <appSettings/>
  <connectionStrings>
  <remove name="LocalSqlServer" />
  <add name="LocalSqlServer" connectionString="Data Source=HLQ;Initial Catalog=IC2_TEST;Integrated Security=True" />
  </connectionStrings>

  <system.web>
  <anonymousIdentification enabled="true"/>
  <profile>
  <properties>
  <add name="PostalCode"
  type="System.String" 
  allowAnonymous="true"/>
  <add name="FavoriteURLs"
  type="System.Collections.Specialized.StringCollection"
  allowAnonymous="true" />
  </properties>
  </profile>
同时也配置好了membership
按照msdn的要求在Global.asax中写了一个函数捕获MigrateAnonymous event。
该函数如下:void Profile_MigrateAnonymous(Object sender, ProfileMigrateEventArgs e)
  { 
  if (Profile.GetProfile(e.AnonymousID).PostalCode != String.Empty)
  {
  Profile.PostalCode = Profile.GetProfile(e.AnonymousID).PostalCode;
  }
  }
编译时就报错:The type or namespace name 'ProfileMigrateEventArgs' could not be found (are you missing a using directive or an assembly reference?)

而且在Profile_MigrateAnonymous()中根本就不能引用Profile,但是我在*.aspx 页面中确可以引用Profile(是profileCommom的一个实例)?

请问大家这个问题如何解决?对在web application中使用profile有没有建议和心得?不甚感激。


------解决方案--------------------
给你个经典的,里面有很多例子.
http://forums.asp.net/25.aspx
------解决方案--------------------
webcast

http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032328459&EventCategory=3&culture=zh-CN&CountryCode=CN
------解决方案--------------------
使用WebProfile工具生成Profile类
到Google一搜索WebProfile就知道了