Start external process from ASP.Net

  • Thread starter Thread starter Kristina Foxwell
  • Start date Start date
K

Kristina Foxwell

Hello:
I am currently having problems with an ASP.NET page...I've never
programmed in ASP or HTML so all of this is new to me.
I have a table that contains a list of files. The columns are a Document
Description, the Filename (with the application extension) of the document,
and a button that will say "View Document". When the user clicks on a
button, I have pull up the document in the application it belongs to. I will
need to pull up documents for Word, Excel, Project, etc....For example, if I
click a button to view an Excel document, I have to start Microsoft Excel
and pull that document up. I'm dynamically creating the table so I can't use
the <asp:button> tag in the aspx.vb file...or can you? How do I bind each
button to a separate document? Do I need <input type = button> instead? Is
there any way to do this?

This is what I currently have in the Form.aspx.vb file to define the button:

'add a button to the table cell
objCell.Text = "<input type='submit' name='btnView'
onClick='ViewDoc_Click()' value='View Document'>"

ViewDoc_Click( ) will go to the database and retrieve the full file path,
and then call another procedure to start the external application.

I'm new to ASP, HTML, & ASP.NET...any help would be greatly appreciated.

Thanks,
Kristina Foxwell
 
Have each button go to a special download page. Pass the Image ID on the querystring, so it looks kind of like this: http://localhost/myproj/download.aspx?FileID=43

Then in your download.aspx have some code similar to this:


Dim dr As System.Data.SqlClient.SqlDataReader


Response.Clear

cmdGetFile.Parameters("@File_ID").Value = _ Request("FileID").ToString

dbConn.Open()

dr = cmdGetFile.ExecuteReader


If dr.Read Then

Response.ContentType = dr("ContentType").ToString

Response.OutputStream.Write(CType(dr("FileData"), Byte()), _

0, CInt(dr("FileSize")))

Else

Response.Write("File Not Found.")

End If



Here's more info:

http://www.aspnetpro.com/features/2003/07/asp200307so_f/asp200307so_f.asp
 
Back
Top