Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Create and display HTML
Message
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Versions des environnements
Environment:
VB 8.0
Divers
Thread ID:
01414154
Message ID:
01414475
Vues:
50
I am pretty sure that your file opens on the server. You better add a webbrowser control to your application and display the file into the webbrowser.


>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
>
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform