try { string port = textBox2.Text; if (!Directory.Exists(port)) { ServerManager serverManager = new ServerManager(); Site site = serverManager.Sites.FirstOrDefault(s => s.Name == "Racing"); SiteCollection coll = serverManager.Sites; foreach (Site indsite in coll) { Microsoft.Web.Administration.Binding binding = site.Bindings.Where(b => b.Protocol == "http").FirstOrDefault(); MessageBox.Show(binding.BindingInformation.ToString()); } MessageBox.Show("port number is valid"); } else { MessageBox.Show("invalid"); } } catch (Exception port) { MessageBox.Show(port.Message); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)