Represents an Internet Information Services (IIS) load-balanced Web application that is installed on the server farm.
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No
[GuidAttribute("113FB569-7520-4651-8FC4-E9F4F5887618")] [SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)] [SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)] public class SPWebApplication : SPPersistedUpgradableObject, IBackupRestore, IMigratable
All servers that run the parent Web service (SPWebService) of the Web application must have a provisioned instance of the application. All instances of the application must be configured identically.
Various objects in the Microsoft.SharePoint.Administration namespace provide a WebApplication property through which you can access the containing Web application. Use the WebApplication property of the SPSite class to get the Web application that contains a site collection. To get the Web application of the current HTTP context, you can use SPContext.Current.Site.WebApplication.
Use the WebApplications property of the SPWebService class to return an SPWebApplicationCollection object that represents the collection of Web applications within a Web service. Use an indexer to return a single Web application from the collection. For example, if the collection is assigned to a variable named myWebApplications, use myWebApplications[index] in C#, or myWebApplications(index) in Visual Basic, where index is either the name or the GUID that identifies the Web application.
The following example uses the Lookup method to change the maximum file size and per-user alert settings for a specified Web application.