Protected Sub btnPreviewTechSpecs_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnPreviewTechSpecs.Click Dim FilePath As String strBodyHTML = Trim(txbTechnicalSpecs.Text) ''1 = Production; 2 = Development FilePath = GenerateHTMLPreviewFile("HTMLPreviewTechSpecs", 1) OpenDocument(FilePath.ToString) End Sub Public Function GenerateHTMLPreviewFile(ByVal FileName As String, _ ByVal Environment As Integer) Dim FilePath As String If Environment = 1 Then 'Production FilePath = "\temp\" & Trim(FileName) & ".html" Else 'Development FilePath = Request.PhysicalApplicationPath.ToString & "temp\" & Trim(FileName) & ".html" End If Dim TextFile As New StreamWriter(FilePath.ToString) TextFile.WriteLine("<H1><font face=""arial"" size=""1""><a href=""javascript:window.close()"">Close Window</a></font></H1>") TextFile.WriteLine(strBodyHTML.ToString) TextFile.Close() Return FilePath End Function Public Function OpenDocument(ByVal DocName As String) As Boolean 'needs: Imports System.Diagnostics.Process Try Start(DocName) Return True Catch Return False End Try End Function