Open File

G

Guest

Dear Experts,

I'm trying to open a file from my web form. However, when I click on the
button, no action is being performed. I have tried running it in debugging
mode, the file is able to open. Below is the partial of my code
-------------------------------------------------------------------------------------------
<td colspan="1" style="height: 20px">
<asp:Label ID="lblAttachment" runat="server"
Text="Attachment:" Visible="False"></asp:Label></td>
<td colspan="5" style="height: 20px">
<asp:TextBox ID="txtAttachment" runat="server"
BorderStyle="None" ReadOnly="True" Visible="False"
Width="250px"></asp:TextBox>
<asp:Button ID="btnViewAttachment" runat="server"
Text="View" Visible="False" OnClick="ViewDoc" /></td>

---------------------------------------------------------------------------------------------
Public Sub ViewDoc(ByVal Source As Object, ByVal E As EventArgs)
Dim strFilename As String
'Dim blnOpenDoc As Boolean
strFilename = Trim(txtAttachment.Text)
Try
Dim Proc As New System.Diagnostics.Process
Proc.StartInfo.WorkingDirectory =
"C:\Data\Websites\Intranet\TeknionLocal\FrontPage2000\Teknion\ITRS\App_Data\Attachments"
Proc.StartInfo.FileName = strFilename
Proc.Start()
'OpenDocument(strFilename)
'Return True
Catch ex As Exception

End Try
End Su
----------------------------------------------------------------------------------------------

Please advise on what is the mistake I have done or I have not done to put
into the code. The document that I tried to open is Word and Excel.
Many thanks in advance.

Regards,
SB
 
G

Guest

Hi there Seok,

I'm not sure if you are aware what you're doing now :) You're opening a file
(creating a process) on the server not on the client, so it works only if you
browse this page from the same machine as web server. If you want to
attach/embed excel/word document to a page (you have already created related
post) use MIME attachements with Response.ContentType.

Hope this helps
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top