Share via


SPVirtualServerConfig.Properties property

NOTE: This API is now obsolete.

Gets configuration settings that are used on the virtual server.

Namespace:  Microsoft.SharePoint.Administration
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'Declaration
<ObsoleteAttribute("Use SPWebApplication or SPIisSettings instead.",  _
    False)> _
Public ReadOnly Property Properties As SPPropertyBag
    Get
'Usage
Dim instance As SPVirtualServerConfig
Dim value As SPPropertyBag

value = instance.Properties
[ObsoleteAttribute("Use SPWebApplication or SPIisSettings instead.", 
    false)]
public SPPropertyBag Properties { get; }

Property value

Type: Microsoft.SharePoint.Utilities.SPPropertyBag
An Microsoft.SharePoint.Utilities.SPPropertyBag object that contains the virtual server configuration settings. For information about the string keys represented in the property bag, see "Command-Line Properties" in the Administrator's Guide for SharePoint Foundation.

Examples

The following code example iterates through the collection of key-and-value pairs that are returned by the Properties property and displays each pair. The example requires using directives (Imports in Visual Basic) for both the Microsoft.SharePoint.Administration and Microsoft.SharePoint.Utilities namespaces.

Dim globAdmin As New SPGlobalAdmin()
Dim vServer As SPVirtualServer = globAdmin.VirtualServers(0)

Dim propBag As SPPropertyBag = vServer.Config.Properties
Dim keys As System.Collections.ICollection = propBag.Keys
Dim key As Object

For Each key In  keys
    Response.Write(SPEncode.HtmlEncode(key.ToString()) + " :: " + SPEncode.HtmlEncode(propBag(key.ToString())) + "<BR>")
Next key
SPGlobalAdmin globAdmin = new SPGlobalAdmin();
SPVirtualServer vServer = globAdmin.VirtualServers[0];

SPPropertyBag propBag = vServer.Config.Properties;
System.Collections.ICollection keys = propBag.Keys;

foreach (object key in keys)
{
    Response.Write(SPEncode.HtmlEncode(key.ToString()) + " :: " + SPEncode.HtmlEncode(propBag[key.ToString()]) + "<BR>");
}

The following example uses the Properties property to enable security validation and its expiration, as well as to set the timeout for security validation to 40 minutes.

Dim globalAdmin As New SPGlobalAdmin()
Dim vServer As SPVirtualServer = globalAdmin.OpenVirtualServer(New Uri("http://Virtual_Server"))

vServer.Config.Properties("securityvalidation-enabled") = Boolean.TrueString
vServer.Config.Properties("securityvalidation-expire") = Boolean.TrueString
vServer.Config.Properties("securityvalidation-timeout") = "40"
vServer.Config.Properties.Update()

globalAdmin.Close()
SPGlobalAdmin globalAdmin = new SPGlobalAdmin();
SPVirtualServer vServer = globalAdmin.OpenVirtualServer(new Uri("http://Virtual_Server"));

vServer.Config.Properties["securityvalidation-enabled"] = bool.TrueString;
vServer.Config.Properties["securityvalidation-expire"] = bool.TrueString;
vServer.Config.Properties["securityvalidation-timeout"] = "40";

vServer.Config.Properties.Update();

globalAdmin.Close();

See also

Reference

SPVirtualServerConfig class

SPVirtualServerConfig members

Microsoft.SharePoint.Administration namespace