I've managed to get ASP.NET to open a local pdf document directly to the browser using the code below. However, I'm trying to do the same thing with a pdf document on my local file system (i.e. C:\test\acrobat.pdf), but I keep getting an error saying that the file does not exist. ASP.NET, IIS and my own login have full permissions to this directory, but when I assign "C:\test\acrobat.pdf" to the 'FilePath' variable, I'm getting the error that the file does not exist. Has anyone got any experience of doing this?
Thanks
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'Get the physical path to the file.
Dim FilePath As String = MapPath("acrobat.pdf")
'Set the appropriate ContentType.
Response.ContentType = "Application/pdf"
'Write the file directly to the HTTP content output stream.
Response.WriteFile(FilePath)
Response.[End]()
End Sub
Thanks
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'Get the physical path to the file.
Dim FilePath As String = MapPath("acrobat.pdf")
'Set the appropriate ContentType.
Response.ContentType = "Application/pdf"
'Write the file directly to the HTTP content output stream.
Response.WriteFile(FilePath)
Response.[End]()
End Sub