• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3192
  • Last Modified:

Open a PDF file with VB.NET

the code below work fine while in the devloping environment but does nothing when the page is published and does not raise any errors any clue why?
the web server is 2003 server with IIS set up to emulate .net framework 2
 
   Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.SelectedIndexChanged
        Dim filename As String
        Dim path As String
        filename = "f:\webso\invoices\" + Trim(GridView1.SelectedRow.Cells(0).Text) + ".pdf"
        path = Page.ResolveClientUrl(filename)
        System.Diagnostics.Process.Start(path)
    End Sub
0
emizrachi
Asked:
emizrachi
  • 4
  • 3
  • 2
1 Solution
 
DhaestCommented:
Does your web-application have the rights for the f-drive.
Can you add a error-handler, perhaps we see an error
Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.SelectedIndexChanged
try
        Dim filename As String
        Dim path As String
        filename = "f:\webso\invoices\" + Trim(GridView1.SelectedRow.Cells(0).Text) + ".pdf"
        path = Page.ResolveClientUrl(filename)
        System.Diagnostics.Process.Start(path)
catch ex as exception
   messagebox.show ex.tostring
end try
    End Sub

Open in new window

0
 
grayeCommented:
It's more likely that you really intended to send the pdf to the client PC to be rendered by the client's browser (rather than render it on the Web server via a Process.Start)
0
 
emizrachiAuthor Commented:
can you send me a code snippet for that or point me in the right direcion.
where can i find a sample code for that
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
emizrachiAuthor Commented:
Dhaest
thanks for the reply
there is an F drive and the files are there i don't get any errors from the browser it just show done on the bottom left side of the page but nothing is open.
i tried as a test to remove the files to see if an error will be triggered and it did so the files are in the right place.
0
 
DhaestCommented:
Do you have a popup-blocker installed ?
Do you have a pdf-reader installed ?
0
 
emizrachiAuthor Commented:
no popup blocker
yes PDF reader installed
0
 
DhaestCommented:
Can you give this a try
Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.SelectedIndexChanged
        Dim filename As String
        Dim path As String
        filename = "f:\webso\invoices\" + Trim(GridView1.SelectedRow.Cells(0).Text) + ".pdf"
        path = Page.ResolveClientUrl(filename)
        response.redirect(path)
    End Sub

Open in new window

0
 
grayeCommented:
I keep wondering if the Author had intended to render the PDF on the server... or send it to the client to be rendered in the browser
0
 
emizrachiAuthor Commented:
at this point i don't care i would rather send to client to be open on his browser
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 4
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now