将你的Asp.NET应用程序嵌入到SharePoint 读后感[转]

感觉不错,就转过来了。

这种方式开发比较方便,不过有一个大问题就是失去了Sharepoint的特色,不能定制自己的portal了,还是开发webpart比较正规一点:)

以下转自:http://hi.baidu.com/hunterzou/blog/item/ef002bb10f4fc75008230225.html

第一点:将生成的dll拷贝到网站目录下bin文件夹

第二点:在网站web.config文件的<SafeControls></SafeControls>节点中添加以下(目的是把应用程序注册为安全类型)

<SafeControl Assembly="WebInMOSS, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" Namespace="WebInMOSS" TypeName="*" Safe="True" />

说明:其中WebInMOSS为应用程序的命名空间

第三点:删除页面的AutoEventWireup="true"属性

第四点:Web.config 文件的<SharePoint>节点,在 <PageParserPaths> </PageParserPaths>

节点下增加一个虚拟路径 <PageParserPath VirtualPath="/*" CompilationMode="Always" AllowServerSideScript="true" IncludeSubFolders="true" />

声明此站点下所有文件允许服务器端事件,当然你也可以制定虚拟目录是那个文件夹,但是这个值 必须以 ~/ 或 / 开头,并且必须以文件名或 * 结尾。

(目的为允许服务器端事件的运行)

第五点:把web.config文件的enableSessionState属性设为true(如果此应用程序要使用到Session的话)

<pages enableSessionState="false" enableViewState="true" enableViewStateMac="true" validateRequest="false"

pageParserFilterType="Microsoft.SharePoint.ApplicationRuntime.SPPageParserFilter, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral,

PublicKeyToken=71e9bce111e9429c" asyncTimeout="7">

第六点:在网站web.config文件的<SafeControls></SafeControls>节点中添加以下(目的是允许应用程序使用用户控件)

<SafeControl Src="~/Pages/*" IncludeSubFolders="True" Safe="True" AllowRemoteDesigner="True" />

说明:其中Pages是用户控件所在的文档库