473,698 Members | 2,869 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Opening a word document on server in client browser

1 New Member
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 = window.open(""" http://www.domain_here.org/WebApp/WordFolder/" & 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
1 2176
balabaster
797 Recognized Expert Contributor
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("http://www.domain_here.org/WebApp/WordFolder/" & strFileNm);
It makes a lot more sense than doing the whole client side opening a new window etc. - a lot simpler. The response.redire ct should ask them if they want to open the file or save it.
Mar 31 '08 #2

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

Similar topics

4
11131
by: Yohancef Chin | last post by:
Hi, Being fairly new to .NET I am looking for a way to call MS Word from an event on a webform, and after the user is finished save that created document to an SQL Server database. Has anyone done this? Does it seem possible? I followed the instructions from a sample on the Microsoft knowledge base but it only seems to work when creating a VB.NET Windows .EXE, not an VB.NET ASP app.
3
6123
by: Yohancef Chin | last post by:
Hi, Being fairly new to .NET I am looking for a way to call MS Word from an event on a webform, and after the user is finished save that created document to an SQL Server database. Has anyone done this? Does it seem possible? I followed the instructions from a sample on the Microsoft knowledge base but it only seems to work when creating a VB.NET Windows .EXE, not an VB.NET ASP app.
2
1241
by: Parag Joshi | last post by:
Hi, I have a peculiar problem. Hope some body can help. I want to open up a word document on the client from a ASPX page. When a user clicks a button I want to show him a word document whose contents have to come from the server. The problem is my server will not have any office application installed on it. Is it possible? Could somebody please help me with this. thanks in advance. Parag Joshi
2
1936
by: KnotKnormal | last post by:
I would like to dynamically load a HTML page (or a Word document), which is embedded in a table when the user clicks on a hyperlink to go from HTML page one to HTML page two. For example, I would like the secretary at a school to update a Word document concerning homework assignments. This Word document would reside on the server. When changes are made it, these changes are automatically updated to the web page. This would simplify life...
4
1742
by: Thomas Scheiderich | last post by:
I can't seem to open a word document from any of my browsers except the one on my web server. Here is the .aspx file: ***************************************************************** <%@ Import Namespace="System.Data.SqlClient" %> <%@ import Namespace="System.IO" %> <Script Runat="Server">
1
2155
by: ourspt | last post by:
Hi, We are working on an ASP.NET (VB.NET) application and we have a problem opening a word document from our application. When we try to open the word document, we do not get any error message but the system hangs.
4
2027
by: enak | last post by:
I need to open a Word template so that I can merge some data from a database with the document. I am using ASP.NET, VB.NET. I can not even get MS Word to be visible. I can see that an instance is created in Task Manager. Here is my code: Private Sub createReport() Dim missing As Object = System.Reflection.Missing.Value Dim file_name As String Dim file_path As String
7
3212
by: mkorch17 | last post by:
Hello, I have a server with a Word document and an Access database on it. I also have an ASP page running on the server. The Word document contains a mail merge with the Access database. What I want to do is open the merged Word document from the ASP page when a button is clicked. I have tried several things including some scripting that I found on the internet. This scripting works, however it opens the merged document on the...
5
2564
by: Cedric | last post by:
Hi Folks, I'm wondering if someone has already succeed to open a word2000 document located on server side with javascript code executed by a web browser on client side. In fact, i make it without any problem when the client use Word XP & 2003 but no result with Word 2000. Any suggestions are welcomed,
0
8603
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9157
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8861
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7723
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4366
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2328
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.