當前位置: 首頁>>代碼示例>>C#>>正文


C# Web.WebSite類代碼示例

本文整理匯總了C#中WebsitePanel.Providers.Web.WebSite的典型用法代碼示例。如果您正苦於以下問題:C# WebSite類的具體用法?C# WebSite怎麽用?C# WebSite使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


WebSite類屬於WebsitePanel.Providers.Web命名空間,在下文中一共展示了WebSite類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: BindSecuredFolders

		public void BindSecuredFolders(WebSite site)
        {
            // save initial state
            IsSecuredFoldersInstalled = site.SecuredFoldersInstalled;
			// Render a warning message about the automatic site's settings change
			if (!IsSecuredFoldersInstalled && site.IIs7)
			{
				// Ensure the message is displayed only when neccessary
				if (site.EnableWindowsAuthentication || !site.AspNetInstalled.EndsWith("I"))
				{
					string warningStr = GetLocalizedString("EnableFoldersIIs7Warning.Text");
					// Render a warning only if specified
					if (!String.IsNullOrEmpty(warningStr))
						btnToggleSecuredFolders.OnClientClick = String.Format("return confirm('{0}')", warningStr);
				}
			}
            // toggle
            ToggleControls();
        }
開發者ID:lwhitelock,項目名稱:Websitepanel,代碼行數:19,代碼來源:WebSitesSecuredFoldersControl.ascx.cs

示例2: SetWebSiteApplicationPool

		/// <summary>
		/// Creates if needed dedicated iisAppObject pools and assigns to specified site iisAppObject pool according to 
		/// selected ASP.NET version.
		/// </summary>
		/// <param name="site">WEb site to operate on.</param>
		/// <param name="createAppPools">A value which shows whether iisAppObject pools has to be created.</param>
        private void SetWebSiteApplicationPool(WebSite site, bool createAppPools)
        {
			var aphl = new WebAppPoolHelper(ProviderSettings);
			// Site isolation mode
			var sisMode = site.DedicatedApplicationPool ? SiteAppPoolMode.Dedicated : SiteAppPoolMode.Shared;
			// Create dedicated iisAppObject pool name for the site with installed ASP.NET version
			if (createAppPools && site.DedicatedApplicationPool)
			{
				// Find dedicated app pools
				var dedicatedPools = Array.FindAll<WebAppPool>(aphl.SupportedAppPools.ToArray(),
					x => aphl.isolation(x.Mode) == SiteAppPoolMode.Dedicated);
				// Generate dedicated iisAppObject pools names and create them.
				foreach (var item in dedicatedPools)
				{
					// Retrieve .NET Framework version
					var dotNetVersion = aphl.dotNetVersion(item.Mode);
					//
					var enable32BitAppOnWin64 = Enable32BitAppOnWin64;
					// Force "enable32BitAppOnWin64" set to true for .NET v1.1
					if (dotNetVersion == SiteAppPoolMode.dotNetFramework1)
						enable32BitAppOnWin64 = true;
					//
					var poolName = WSHelper.InferAppPoolName(item.Name, site.Name, item.Mode);
					// Ensure we are not going to add an existing app pool
					if (webObjectsSvc.IsApplicationPoolExist(poolName))
						continue;
					//
					using (var srvman = webObjectsSvc.GetServerManager())
					{
						// Create iisAppObject pool
						var pool = srvman.ApplicationPools.Add(poolName);
						pool.ManagedRuntimeVersion = aphl.aspnet_runtime(item.Mode);
						pool.ManagedPipelineMode = aphl.runtime_pipeline(item.Mode);
						pool.Enable32BitAppOnWin64 = enable32BitAppOnWin64;
						pool.AutoStart = true;
						// Identity
						pool.ProcessModel.IdentityType = ProcessModelIdentityType.SpecificUser;
						pool.ProcessModel.UserName = GetQualifiedAccountName(site.AnonymousUsername);
						pool.ProcessModel.Password = site.AnonymousUserPassword;
						// Commit changes
						srvman.CommitChanges();
					}
				}
			}
			// Find
			var siteAppPool = Array.Find<WebAppPool>(aphl.SupportedAppPools.ToArray(),
				x => x.AspNetInstalled.Equals(site.AspNetInstalled) && aphl.isolation(x.Mode) == sisMode);
			// Assign iisAppObject pool according to ASP.NET version installed and isolation mode specified.
			site.ApplicationPool = WSHelper.InferAppPoolName(siteAppPool.Name, site.Name, siteAppPool.Mode);
        }
開發者ID:jordan49,項目名稱:websitepanel,代碼行數:56,代碼來源:IIs70.cs

示例3: UpdateSiteAsync

 /// <remarks/>
 public void UpdateSiteAsync(WebSite site) {
     this.UpdateSiteAsync(site, null);
 }
開發者ID:jordan49,項目名稱:websitepanel,代碼行數:4,代碼來源:WebServerProxy.cs

示例4: UpdateSite

 public void UpdateSite(WebSite site) {
     this.Invoke("UpdateSite", new object[] {
                 site});
 }
開發者ID:jordan49,項目名稱:websitepanel,代碼行數:4,代碼來源:WebServerProxy.cs

示例5: CreateSite

 public string CreateSite(WebSite site) {
     object[] results = this.Invoke("CreateSite", new object[] {
                 site});
     return ((string)(results[0]));
 }
開發者ID:jordan49,項目名稱:websitepanel,代碼行數:5,代碼來源:WebServerProxy.cs

示例6: CheckCertificateAsync

 /// <remarks/>
 public void CheckCertificateAsync(WebSite webSite)
 {
     this.CheckCertificateAsync(webSite, null);
 }
開發者ID:jordan49,項目名稱:websitepanel,代碼行數:5,代碼來源:WebServerProxy.cs

示例7: CheckCertificate

 public bool CheckCertificate(WebSite webSite)
 {
     object[] results = this.Invoke("CheckCertificate", new object[] {
                 webSite});
     return ((bool)(results[0]));
 }
開發者ID:jordan49,項目名稱:websitepanel,代碼行數:6,代碼來源:WebServerProxy.cs

示例8: ImportCertificate

 public SSLCertificate ImportCertificate(WebSite website)
 {
     object[] results = this.Invoke("ImportCertificate", new object[] {
                 website});
     return ((SSLCertificate)(results[0]));
 }
開發者ID:jordan49,項目名稱:websitepanel,代碼行數:6,代碼來源:WebServerProxy.cs

示例9: installCertificate

 public SSLCertificate installCertificate(SSLCertificate certificate, WebSite website)
 {
     object[] results = this.Invoke("installCertificate", new object[] {
                 certificate,
                 website});
     return ((SSLCertificate)(results[0]));
 }
開發者ID:jordan49,項目名稱:websitepanel,代碼行數:7,代碼來源:WebServerProxy.cs

示例10: getCertificateAsync

 /// <remarks/>
 public void getCertificateAsync(WebSite site)
 {
     this.getCertificateAsync(site, null);
 }
開發者ID:jordan49,項目名稱:websitepanel,代碼行數:5,代碼來源:WebServerProxy.cs

示例11: getCertificate

 public SSLCertificate getCertificate(WebSite site)
 {
     object[] results = this.Invoke("getCertificate", new object[] {
                 site});
     return ((SSLCertificate)(results[0]));
 }
開發者ID:jordan49,項目名稱:websitepanel,代碼行數:6,代碼來源:WebServerProxy.cs

示例12: UpdateWebSite

 public int UpdateWebSite(WebSite site)
 {
     object[] results = this.Invoke("UpdateWebSite", new object[] {
                 site});
     return ((int)(results[0]));
 }
開發者ID:lwhitelock,項目名稱:Websitepanel,代碼行數:6,代碼來源:WebServersProxy.cs

示例13: UpdateWebSite

        public static int UpdateWebSite(WebSite site)
        {
            // check account
            int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
            if (accountCheck < 0) return accountCheck;

            // load web site item
            WebSite siteItem = (WebSite)PackageController.GetPackageItem(site.Id);
            if (siteItem == null)
                return BusinessErrorCodes.ERROR_WEB_SITE_PACKAGE_ITEM_NOT_FOUND;

            // place log record
            TaskManager.StartTask("WEB_SITE", "UPDATE", siteItem.Name);
            TaskManager.ItemId = site.Id;

            try
            {
                // update home folder
                string origPath = site.ContentPath;
                site.ContentPath = FilesController.GetFullPackagePath(site.PackageId, site.ContentPath);

                // build data folder path
                site.DataPath = siteItem.DataPath;

                // update site on the service
                WebServer web = new WebServer();
                ServiceProviderProxy.Init(web, siteItem.ServiceId);
                web.UpdateSite(site);
				// Restore settings back
				#region Web Deploy Settings
				site.WebDeployPublishingAccount = siteItem.WebDeployPublishingAccount;
				site.WebDeployPublishingPassword = siteItem.WebDeployPublishingPassword;
				site.WebDeploySitePublishingEnabled = siteItem.WebDeploySitePublishingEnabled;
				site.WebDeploySitePublishingProfile = siteItem.WebDeploySitePublishingProfile;
				#endregion

                // update service item
                PackageController.UpdatePackageItem(site);

                // set origpath
                site.ContentPath = origPath;

                return 0;
            }
            catch (Exception ex)
            {
                throw TaskManager.WriteError(ex);
            }
            finally
            {
                TaskManager.CompleteTask();
            }
        }
開發者ID:jordan49,項目名稱:websitepanel,代碼行數:53,代碼來源:WebServerController.cs

示例14: AddWebSite

        public static int AddWebSite(int packageId, int domainId, int packageAddressId,
            bool addInstantAlias)
        {
            // check account
            int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
            if (accountCheck < 0) return accountCheck;

            // check package
            int packageCheck = SecurityContext.CheckPackage(packageId, DemandPackage.IsActive);
            if (packageCheck < 0) return packageCheck;

            // check quota
            QuotaValueInfo sitesQuota = PackageController.GetPackageQuota(packageId, Quotas.WEB_SITES);
            if (sitesQuota.QuotaExhausted)
                return BusinessErrorCodes.ERROR_WEB_SITES_QUOTA_LIMIT;

            // load domain name
            DomainInfo domain = ServerController.GetDomain(domainId);
            string domainName = domain.DomainName;

            // check if the web site already exists
            if (PackageController.GetPackageItemByName(packageId, domainName, typeof(WebSite)) != null)
                return BusinessErrorCodes.ERROR_WEB_SITE_ALREADY_EXISTS;

            // place log record
            TaskManager.StartTask("WEB_SITE", "ADD", domainName);

            try
            {

                // get service
                int serviceId = PackageController.GetPackageServiceId(packageId, ResourceGroups.Web);
                if (serviceId == 0)
                    return BusinessErrorCodes.ERROR_WEB_SITE_SERVICE_UNAVAILABLE;

				#region Fix for bug #587
				// Initialize IIS provider webservice proxy
				WebServer web = new WebServer();
				ServiceProviderProxy.Init(web, serviceId);

				// Ensure the web site is being created doesn't exist on the server
				if (web.SiteExists(domainName))
				{
					//
					PackageInfo packageInfo = PackageController.GetPackage(packageId);
					//
					ServerInfo serverInfo = ServerController.GetServerById(packageInfo.ServerId);
					// Give as much clues for the issue to an administrator as possible
					TaskManager.WriteError("Web site '{0}' could not be created because site with the name requested already " +
						"exists on '{1}' server.", domainName, serverInfo.ServerName);
					// Return generic operation failed error
					return BusinessErrorCodes.FAILED_EXECUTE_SERVICE_OPERATION;
				} 
				#endregion

                // load web settings
                StringDictionary webSettings = ServerController.GetServiceSettings(serviceId);
                int addressId = Utils.ParseInt(webSettings["SharedIP"], 0);

                bool dedicatedIp = false;
                if (packageAddressId != 0)
                {
                    // dedicated IP
                    PackageIPAddress packageIp = ServerController.GetPackageIPAddress(packageAddressId);
                    if (packageIp != null)
                    {
                        addressId = packageIp.AddressID;
                        dedicatedIp = true;
                    }
                }

                // load assigned IP address
                string ipAddr = "*";
                IPAddressInfo ip = ServerController.GetIPAddress(addressId);
                if (ip != null)
                    ipAddr = !String.IsNullOrEmpty(ip.InternalIP) ? ip.InternalIP : ip.ExternalIP;

                // load domain instant alias
                string instantAlias = ServerController.GetDomainAlias(packageId, domainName);
                DomainInfo instantDomain = ServerController.GetDomain(instantAlias);
                if (instantDomain == null || instantDomain.WebSiteId > 0)
                    instantAlias = "";

                // load web DNS records
                List<GlobalDnsRecord> dnsRecords = ServerController.GetDnsRecordsByService(serviceId);

                // prepare site bindings
                List<ServerBinding> bindings = new List<ServerBinding>();

                if (!dedicatedIp)
                {
                    // SHARED IP
                    // fill main domain bindings
                    FillWebServerBindings(bindings, dnsRecords, ipAddr, domain.DomainName);

                    // fill alias bindings if required
                    if (addInstantAlias && !String.IsNullOrEmpty(instantAlias))
                    {
                        // fill bindings from DNS "A" records
                        FillWebServerBindings(bindings, dnsRecords, ipAddr, instantAlias);
//.........這裏部分代碼省略.........
開發者ID:jordan49,項目名稱:websitepanel,代碼行數:101,代碼來源:WebServerController.cs

示例15: DeleteCertificateAsync

 /// <remarks/>
 public void DeleteCertificateAsync(SSLCertificate certificate, WebSite website)
 {
     this.DeleteCertificateAsync(certificate, website, null);
 }
開發者ID:jordan49,項目名稱:websitepanel,代碼行數:5,代碼來源:WebServerProxy.cs


注:本文中的WebsitePanel.Providers.Web.WebSite類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。