Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Create and display HTML
Message
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Titre:
Create and display HTML
Versions des environnements
Environment:
VB 8.0
Divers
Thread ID:
01414154
Message ID:
01414154
Vues:
87
Hi All,

I have the following VB.NET code that generates HTML file and opens it in another browser window. This works fine in the development environment. Once I deploy it to the web server the HTML document is being generated but it does not open.

Any ideas?

Thank you,
DAniel
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform