Download word doc?

  • Thread starter Thread starter Andy
  • Start date Start date
A

Andy

Using FP 2002, sp2, how can I force a user to download a word document, and
not open it directly in the browser window?

Thanks,


Andy
 
Andy,
You can't. Browsers will always attempt to open documents in the
appropriate container or application. The best thing you can do is to zip
the Word doc so users can then download the .zip file and extract the WOrd
doc.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage
 
-----Original Message-----
Using FP 2002, sp2, how can I force a user to download a
word document, and not open it directly in the browser
window?

Actually, this is fairly simple if your Web server is
Windows Server 2003 or has the .NET Framework installed.
In that case, add a Web page containing these statements
to your Web:

<html>
<head>
<title>Download</title>
</head>
<body>
<%
Response.Clear()
Response.ContentType = "application/x-data"
Response.AddHeader("content-disposition", _
"attachment; filename=test.doc")

Response.WriteFile(Server.MapPath("test.doc"))
Response.End()
%>
</body>
</html>

Just above the blank line, test.doc specifies the default
file name that will appear in the visitor's download
dialog box.

Just below the blank line, test.doc specifies the
relative path and filename (on the Web server) of the
file you want to download.

Be sure to save this Web page with a filename extension
of .aspx rather than .asp.


Life isn't so good if your Web server can only run ASP
pages. This is because in ASP, the Response.WriteFile
method isn't available. In this case you must either:

o Zip up your file, as others have suggested.

o Build an ordinary link to your .doc file, then tell
your visitors to right-click that link and choose
Save Target As from the shortcut menu.

Jim Buyens
Microsoft FrontPage MVP
(e-mail address removed)
http://www.interlacken.com
Author of:
*------------------------------------------------------*
|\----------------------------------------------------/|
|| Microsoft Office FrontPage 2003 Inside Out ||
|| Microsoft FrontPage Version 2002 Inside Out ||
|| Web Database Development Step by Step .NET Edition ||
|| Troubleshooting Microsoft FrontPage 2002 ||
|| Faster Smarter Beginning Programming ||
|| (All from Microsoft Press) ||
|/----------------------------------------------------\|
*------------------------------------------------------*
 
Looks like we will go with the .zip files, I think the real problem is
browser specific, because I get different results on different PC's.

Have a look at the site www.sdmha.org and the specific pages are in the
tournaments section.

Thank you's to everyone who replied.

ANdy
 
Back
Top