helen.trim
New member
- Joined
- Sep 30, 2014
- Messages
- 3
- Programming Experience
- 10+
In Visual Studio 2012, I am developing a web application that needs to open Word or PDF documents. In testing, this code works well but when the web page is published, it gives the error message: The system cannot find the file specified.
Dim OpenDocument As New ProcessStartInfo
Dim FilePath As String
FilePath = "C:\Test.docx"
Try
Process.Start(FilePath)
Catch ex As Exception
lblMessage.Text = ex.Message
End Try
I tried adding in credentials, but it made no difference:
Dim Password As New System.Security.SecureString
OpenDocument.UserName = "myusername"
Password.AppendChar("p")
Password.AppendChar("a")
Password.AppendChar("s")
Password.AppendChar("s")
OpenDocument.Password = Password
OpenDocument.Domain = "XSWHANTS"
OpenDocument.UseShellExecute = False
Again, this works when testing but gives the same error message when published.
Am I missing something obvious? Thank you for your help.
Dim OpenDocument As New ProcessStartInfo
Dim FilePath As String
FilePath = "C:\Test.docx"
Try
Process.Start(FilePath)
Catch ex As Exception
lblMessage.Text = ex.Message
End Try
I tried adding in credentials, but it made no difference:
Dim Password As New System.Security.SecureString
OpenDocument.UserName = "myusername"
Password.AppendChar("p")
Password.AppendChar("a")
Password.AppendChar("s")
Password.AppendChar("s")
OpenDocument.Password = Password
OpenDocument.Domain = "XSWHANTS"
OpenDocument.UseShellExecute = False
Again, this works when testing but gives the same error message when published.
Am I missing something obvious? Thank you for your help.