Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code to open file outside browser. 2

Status
Not open for further replies.

Turpis

Programmer
Apr 16, 2002
151
Is it possible to open any file (as long as application is installed of course) outside of the browser with ASP code?

This code opens files inside the browser.
Me.Response.Redirect("file:///" & "TestFile.doc")

I am not looking for Word only code, but windows file association file opening.


Charles
Quality Assurance/Developer
 
you'd have to open the shell,winword.exe, which for security reasons is not allowed from a web page.

say hello to windows forms, not web forms!
 
oh well.

Charles
Quality Assurance/Developer
 
Do you mean:

1) Open a file that resides on the server on the clients machine?

2)Open a file that resides on the clients machine on the client?


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
1) As if they browsed to it on the server (or mapped drive) and double clicked it. Should open with whatever application is associated with that extension.

Charles
Quality Assurance/Developer
 
Code:
        Dim fn As String = "w.doc"
        Dim fp As String = MapPath(fn)

        Dim cs As String = "attachment; filename=" & """" & fn & """"

        Response.AddHeader("content-disposition", cs)
        Response.WriteFile(fp)
        Response.End()

But you have to click "Open" (or Save or Cancel) to open the w.doc word document. I did not manage to automate this process and have the button Open clicked for you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top