1. 建立类库的形式,选择framwork3.5.
2. AssemblyInfo.cs文件修改.
a.添加引用 using System.Security;
b.添加代码 [assembly: AllowPartiallyTrustedCallers()]
3. 项目右键属性—>强命名
4. 编译通过。
5. 修改所属网站的webcofing,添加代码,例如:
<SafeControl Assembly="IISZWebPartsTest,Version=1.0.0.0, Culture=neutral, PublicKeyToken=f51c823f70de0cc1"Namespace="IISZWebPartsTest"TypeName="*" Safe="True" />
6. 其中, Assembly 中的值可以通过 Reflector工具得到.
7. 将dll拷贝至所属网站的bin目录下 ,例如
C:\inetpub\wwwroot\wss\VirtualDirectories\1128\bin
或者也可以注册dll到gac中.(如何注册和卸载assembly)
8. 重启IIS
9. 打开网站àSite ActionsàSite SettingàWeb PartsàDocumentàNew Document
1. OK,至此,新建的WebPart已经部署好了。
2. 接下来进行显示至网站上。
3. 打开网站àSite ActionsàEdit PageàAdd a Web Part
1. 点击Add .OK.