Ejemplo n.º 1
0
        public static int UpdateVirtualDirectory(int siteItemId, WebVirtualDirectory vdir)
        {
            // check account
            int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
            if (accountCheck < 0) return accountCheck;

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

            // place log record
            TaskManager.StartTask("WEB_SITE", "UPDATE_VDIR", vdir.Name);
            TaskManager.ItemId = siteItemId;
            TaskManager.WriteParameter("Web site", siteItem.Name);

            try
            {
                // normalize path
                vdir.ContentPath = FilesController.GetFullPackagePath(siteItem.PackageId, vdir.ContentPath);

                // create directory
                WebServer web = new WebServer();
                ServiceProviderProxy.Init(web, siteItem.ServiceId);
                web.UpdateVirtualDirectory(siteItem.SiteId, vdir);

                return 0;
            }
            catch (Exception ex)
            {
                throw TaskManager.WriteError(ex);
            }
            finally
            {
                TaskManager.CompleteTask();
            }
        }