private void buttonOK_Click(object sender, EventArgs e) { WebsiteName = textBox1.Text; if (string.IsNullOrEmpty(WebsiteName)) { MessageBox.Show(this, "Website name cannot be empty", Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { Regex rg = new Regex(@"^([\w])*$"); if (rg.IsMatch(WebsiteName)) { bool iisError; if (IisUtility.FindLocalWebSiteByName(this, WebsiteName, out iisError) != null) { if (!iisError) { MessageBox.Show(this, "The Website Name is in use", Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } else { this.DialogResult = DialogResult.OK; } } else { MessageBox.Show(this, "Please use only alphanumeric characters in Website name", Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } }
public static VirtualWebDir CreateWebSite(LimnorProject project, string websitename, Form owner) { bool iisError = false; VirtualWebDir webSite = project.GetTestWebSite(owner); if (webSite == null) { webSite = IisUtility.FindLocalWebSiteByName(owner, websitename, out iisError); } if (webSite == null && !iisError) { webSite = IisUtility.FindLocalWebSite(websitename); if (webSite == null) { //create the web site DialogProjectOutput dlg = new DialogProjectOutput(); dlg.LoadData(project, websitename); if (dlg.ShowDialog(owner) == DialogResult.OK) { if (dlg.WebSite != null) { webSite = dlg.WebSite; } } } } return(webSite); }