Esempio n. 1
0
        static void Main(string[] args)
        {
            var             Name            = "TestSite Attempt1";
            var             Proto           = "http";
            var             Binding         = "*:80:TestUrl.co.za";
            var             BindingAddProto = "HTTPS";
            var             BindingToAdd    = "Test.co.za";
            var             Path            = @"DirToSite";
            var             RemoveSite      = true;
            CoreIISFeatures cis             = new CoreIISFeatures();

            //var sites = cis.GetIISSite();
            //foreach(Site site in sites)
            //{
            //	Console.WriteLine("Site Id : "+site.Id + " Site Name : " + site.Name);

            //}

            CoreIISFeatures.RemoveIISWebsite(Name, RemoveSite);

            var CreateSite = CoreIISFeatures.CreateSite(Name, Proto, Binding, Path);

            Console.WriteLine(CreateSite);

            var Bindings = CoreIISFeatures.AddBindings(Name, BindingToAdd, BindingAddProto);

            Console.WriteLine(Bindings);
        }
        public ActionResult ListAllSites()
        {
            CoreIISFeatures iISFeatures = new CoreIISFeatures();
            var             result      = iISFeatures.GetIISSite();

            ViewBag.SiteList = result;
            return(View());
        }
        public JsonResult CreateSite(IISSiteModel iISSite)
        {
            var CreateSite = CoreIISFeatures.CreateSite(iISSite.SiteName, iISSite.Proto, iISSite.Bindings, iISSite.PathToSite);

            return(Json(CreateSite));
        }
        public JsonResult DeleteBindings(string hostname, string sitename)
        {
            var DeleteSiteBinding = CoreIISFeatures.RemoveBinding(hostname, sitename);

            return(Json(DeleteSiteBinding));
        }
        public JsonResult AddSSLBindings(int SiteID, string[] BindingToAdd)
        {
            var AddSSLBindingToSite = CoreIISFeatures.AddSSLCertAndBindings(SiteID, BindingToAdd);

            return(Json(AddSSLBindingToSite));
        }
        public JsonResult AddBindings(string siteToAddBinding, string BindingToAdd, string Proto)
        {
            var AddBindingToSite = CoreIISFeatures.AddBindings(siteToAddBinding, BindingToAdd, Proto);

            return(Json(AddBindingToSite));
        }
        // POST api/<controller>
        public string Post(int SiteID, [FromUri] string[] BindingToAdd)
        {
            var AddSSLBindingToSite = CoreIISFeatures.AddSSLCertAndBindings(SiteID, BindingToAdd);

            return(AddSSLBindingToSite);
        }