![]() | |||||
![]() ![]() ![]() ![]() ![]() |
Configure options for Web Parts and Web Part Pages
You can also return to using the default server settings of allowing users to both connect Web Parts and use the Online Web Part gallery, by clicking Restore Defaults.
Configure options for Web Parts and Web Part Pages in the web.config file
There are additional Web Part options you can set in the SharePoint web.config file. The web.config file is a text file containing custom XML elements. You can edit this file using a text editor, such as Microsoft Notepad. By default, the Web.config file is located in the C:\Inetpub\wwwroot\ folder.
The following is a summary of these additional Web Part options and their values.
There are two safe mode attributes.
Specifies the maximum number of server-side controls (HTML Element attribute, runat = "server") on a Web Part Page, including Web Parts, static Web Parts (that is, Web Parts not in a zone) and Web Form Controls. The default value is 50.
Shows or hides many (but not all) ASP.NET exceptions that may occur in addition to the initial error reported in the SharePoint Error page. You can do the following:
You might set this attribute to "true" for developers who are testing Web Parts so they can view these messages on a remote computer. You must also set the customErrors mode in the <system.web> section to "On".
<SharePoint>
<SafeMode MaxControls="30" CallStack="True" />
</SharePoint>
<system.web>
<customErrors mode="On" />
</system.web>
There are two Web Part limit attributes.
Specifies the total number of Web Parts allowed within all Web Part zones on a Web Part Page.
Specifies the maximum number of bytes used to store Web Part properties on the server.
<SharePoint>
<WebPartLimits MaxZoneParts="5" PropertySize="200000" />
</SharePoint>
There is one Web Part cache storage attribute.
Specifies how a Web Part is cached on the server, if at all. You can enter one of the following values:
Value | Description |
---|---|
None | Prevent caching Web Parts on the server. |
CacheObject | Use ASP.NET web server memory caching. This is the default. In general, this value helps improve performance if your site is installed on a single server. |
Database | Cache Web Parts in site server database. In general, this value helps improve performance if your site is installed on a Web farm. |
<SharePoint>
<WebPartCache Storage="Database" />
</SharePoint>
There is one value that controls Web Part processes.
Specifies a timeout value in milliseconds for any asynchronous child processes started by a Web Part. The default size is 5000.
The following is an example of setting the Web Part work item timeout:
<SharePoint>
<WebPartWorkItem Timeout value="7000" />
</SharePoint>
Default security policy and trust level
You can conveniently define and specify a default security policy and trust level for all Web Parts installed on the site server using two configuration files. There are two default policies:
WSS_Minimal A copy of the ASP. NET web_minimaltrust.config file with WebPartPermission.Connections enabled. This is the default.WSS_Medium A copy of ASP.NET web_mediumtrust.config file with WebPartPermission.Connectionsand .SharePointPermission.ObjectModel enabled.
<system.web>
<securityPolicy>
<trustLevel name="WSS_Minimal" policyFile="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\config\wss_minimaltrust.config" />
</securityPolicy>
<trust level="WSS_Minimal" originUrl="" />
</system.web>
<system.web>
<securityPolicy>
<trustLevel name="WSS_Medium" policyFile="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\config\wss_mediumtrust.config" />
</securityPolicy>
<trust level="WSS_Medium" originUrl="" />
</system.web>
Allow access to the online Web Part library from behind a proxy server or firewall
If your server is behind a proxy server or firewall, you must also edit the web.config file for each virtual server for which you want to enable the online Web Part library. In a server farm environment, you must edit this file for each virtual server in every front-end Web server in the server farm.
\Inetpub\wwwroot
<system.net>
<defaultProxy>
<proxy proxyaddress="http://Proxy_Server:port" bypassonlocal = "true"/>
</defaultProxy>
</system.net>
Where Proxy_Server:port is the proxy server or firewall used for your environment.Make a Web Part available in the Web Part Gallery
Add a Web Part to the Web Part gallery
If you have installed a Web Part Package and need to add the Web Parts to the gallery, use the Upload Web Part button to add the new Web Parts to the gallery.
Caution Web Parts contain code. Before adding a Web Part to the Web Part Gallery, make sure it is from a trusted source.
If you have several Web Parts that you want to upload at once, click Upload Multiple Files and select the Web Parts to upload.
Add multiple Web Parts to the Web Part gallery
Uploading multple Web Parts to the Web Part gallery requires a Windows SharePoint Services-compatible client program such as Office 2003 installed on the client machine.
Caution Web Parts contain code. Before adding a Web Part to the Web Part Gallery, make sure it is from a trusted source.
Remove a Web Part from the Web Part Gallery
You can remove a Web Part from the gallery if you want to make it unavailable to users. If a user has already used a Web Part in the site, and you delete the Web Part from the site gallery, the Web Part will remain on the Web Part Page and will still work. However, if an administrator on the server computer removes the Web Part assembly that contains the Web Part from the server, or marks the assembly as unsafe in the Web.config file for the server, the Web Part will no longer run and the user will see an error message.