By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,277 Members | 1,235 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,277 IT Pros & Developers. It's quick & easy.

Opening a word document on server in client browser

P: 1
Here's the problem:

- Website is ASP.NET 1.0
- Server is Windows Server 2003
- Browser is IE 6/7
- Client requests a mail merged MS Word 97 - 2003 document on the website, and the document gets created on the server.
- Need to send the document to the client browser and delete the file from the server.

Previously, the web application already did this, but after some hardware and location changes, the application no longer performs this functionality. The file still successfully gets created, but for some reason, the file does not get opened client-side.

Here is the current code:
Expand|Select|Wrap|Line Numbers
  1. Response.Write("<script>")
  2. Response.Write("var wordWin ="""" & strFileNm & """, ""wordWin"", ""width=800,height=600,menubar=1,resizable=1,scrollbars=yes,status=yes"");")
  3. Response.Write("</script>")
  4. Response.Write("<script>window.location.href = window.location.href;</script>")
strFileNm is the name of the file that was created.

Some additional information... Leaving Response.Write("<script>window.location.href = window.location.href;</script>") causes the client browser to open another window for a brief moment, but no option to open a word document appears, and the file disappears from the server directory. Commenting out that same line of code keeps the file on the server and no window is opened client side. I'm sort of confused about what this line actually does.

One last oddity, the file gets opened when I debug the application on a dev machine, but not when I deploy the application to their live system. I suspect there are permission issues with a remote user accessing a file stored on the server, but I'm not sure how to correct this problem...

Please please please provide me with some assistance. Been troubleshooting this for many hours :)
Mar 31 '08 #1
Share this Question
Share on Google+
1 Reply

Expert 100+
P: 797
I might be tempted to do this slightly differently. In the server side code after the file has been built - do:

Expand|Select|Wrap|Line Numbers
  1. Response.Redirect("" & strFileNm);
It makes a lot more sense than doing the whole client side opening a new window etc. - a lot simpler. The response.redirect should ask them if they want to open the file or save it.
Mar 31 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.