Fork me on GitHub

Asp.net 2.0 WebPart使用经验点滴


这几天学习使用WebPart,发现众多问题,使用点滴记录如下,同各位共享:
1、WebPart的使用必须基于一个通过身份验证的用户会话。
2、WebPart的使用的个性化应用于所有人的选项默认是禁用的,可以通过修改Web.config来完成
<webParts>
   <personalization>
          <authorization>
             <allow users="*" verbs="enterSharedScope" />
          </authorization>
      </personalization>
    </webParts>
3、WebPart 默认使用页面的 URL 存储个性化数据.但是不包含 querystrings,现在要实现在通用的页面(模版)来实现简单的门户系统,通过不同的querystrings来读取个人,部门等的数据。这样个人自己设定的设定可以直接和别人共享。这样的需求在现有的WebPart系统上无法实现,在WebPart Components for Asp.net 2.0: Workspace home URL:http://www.gotdotnet.com/workspaces/workspace.aspx?id=65fa26c3-a62a-49d6-895d-422272e53a0c 有一个这样的WebPart系统可以满足需求。这个WebPart的作者介绍:http://fredrik.nsquared2.com/viewpost.aspx?PostID=326

 4、启用WebPart得导出功能:修改web.config中WebPart的设置
  <webParts enableExport="true">

5、导入自定义的webPart 出现错误:Cannot add a control of Type DotnetClubPortal.WebControls.WebParts.RSSReader. The Type must be loadable by BuildManager.GetType(string typeName).
处理办法:修改web.config文件:
<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <probing privatePath="Bin" />
    </assemblyBinding>
 </runtime>
http://msdn2.microsoft.com/en-us/library/e0s9t4ck(en-US,VS.80).aspx

posted @ 2005-12-03 21:20  张善友  阅读(11510)  评论(11编辑  收藏  举报