private void saveAsToolStripMenuItem_Click(object sender, EventArgs e) { SaveFileDialog dlgSaveFile = new SaveFileDialog(); dlgSaveFile.Filter = "HTML File (*.html, *.htm)|*.html, *.htm"; dlgSaveFile.OverwritePrompt = true; dlgSaveFile.DefaultExt = "*.html"; dlgSaveFile.CheckPathExists = true; dlgSaveFile.AddExtension = true; dlgSaveFile.ShowDialog(); try { if (!string.IsNullOrEmpty(dlgSaveFile.FileName)) { builder.MakeImagePathsRelative(); if (!string.IsNullOrEmpty(builder.HTMLContent)) { builder.SaveHtmlFile(dlgSaveFile.FileName); } else { File.WriteAllText(dlgSaveFile.FileName, HTMLBuilder.FormatHtml(browserDesign.DocumentText)); } FileInfo savedFile = new FileInfo(dlgSaveFile.FileName); builder.CopyImagesToFilePath(savedFile.DirectoryName); builder.LoadHtmlFile(savedFile.FullName); this.Text = savedFile.Name + " - Easy Web Page Builder"; modifiedDocument = false; newFile = false; } } catch (Exception ex) { //this exception does not make any sense if (ex.Message.Contains("URI formats")) { builder.LoadHtmlFile(dlgSaveFile.FileName); this.Text = new FileInfo(dlgSaveFile.FileName).Name + " - Easy Web Page Builder"; modifiedDocument = false; newFile = false; return; } MessageBox.Show(ex.Message + ex.StackTrace, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }