473,657 Members | 2,451 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Client and Office from asp.net

I have an internal asp.net 2.0 web application where we display the contents
of various files using Response.Conten tType and Response.WriteF ile()
settings and it works great for .doc, .xls, etc. files. Now the users want
to be able to open them in their native programs (Microsoft Word, Excel,
etc.). I have done this with ActiveX before, but the company has moved to
Office 2007 and I'm not sure the same process will work for the new docx,
xlsx, etc. files. Can anyone give me some ideas on the best way to handle
this? All users have Microsoft Office. Thanks.

David
Jun 27 '08 #1
7 1055
You should add Content-Disposition to the header.
Like this Content-Disposition: attachment; filename="file. pdf"

So in C# code it's Response.AddHea der("Content-Disposition", "attachment ;
filename=\"file .pdf\"");
And then do Response.WriteF ile

Browser will be forced (thanks to "attachment " word) to pop up a window
offering to save file or open it in application.
George.
"David C" <dl*****@lifeti meinc.comwrote in message
news:ef******** ******@TK2MSFTN GP06.phx.gbl...
>I have an internal asp.net 2.0 web application where we display the
contents of various files using Response.Conten tType and
Response.Write File() settings and it works great for .doc, .xls, etc.
files. Now the users want to be able to open them in their native programs
(Microsoft Word, Excel, etc.). I have done this with ActiveX before, but
the company has moved to Office 2007 and I'm not sure the same process will
work for the new docx, xlsx, etc. files. Can anyone give me some ideas on
the best way to handle this? All users have Microsoft Office. Thanks.

David

Jun 27 '08 #2
George,
Thank you for that info. However, it still does not open in the native
program (Microsoft Word, Microsoft Excel, etc.). It opens it in the browser
where it cannot be edited.

David
"George Ter-Saakov" <gt****@cardone .comwrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
You should add Content-Disposition to the header.
Like this Content-Disposition: attachment; filename="file. pdf"

So in C# code it's Response.AddHea der("Content-Disposition", "attachment ;
filename=\"file .pdf\"");
And then do Response.WriteF ile

Browser will be forced (thanks to "attachment " word) to pop up a window
offering to save file or open it in application.
George.
"David C" <dl*****@lifeti meinc.comwrote in message
news:ef******** ******@TK2MSFTN GP06.phx.gbl...
>>I have an internal asp.net 2.0 web application where we display the
contents of various files using Response.Conten tType and
Response.Writ eFile() settings and it works great for .doc, .xls, etc.
files. Now the users want to be able to open them in their native
programs (Microsoft Word, Excel, etc.). I have done this with ActiveX
before, but the company has moved to Office 2007 and I'm not sure the same
process will work for the new docx, xlsx, etc. files. Can anyone give me
some ideas on the best way to handle this? All users have Microsoft
Office. Thanks.

David


Jun 27 '08 #3
Show me the code.....

PS: There was a bug in IE 5.01 and it ignored the "attachment " .... But I
hope it's not the case here. Since we already have IE 7.

George.
"David C" <dl*****@lifeti meinc.comwrote in message
news:u4******** ******@TK2MSFTN GP06.phx.gbl...
George,
Thank you for that info. However, it still does not open in the native
program (Microsoft Word, Microsoft Excel, etc.). It opens it in the
browser where it cannot be edited.

David
"George Ter-Saakov" <gt****@cardone .comwrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
>You should add Content-Disposition to the header.
Like this Content-Disposition: attachment; filename="file. pdf"

So in C# code it's Response.AddHea der("Content-Disposition", "attachment ;
filename=\"fil e.pdf\"");
And then do Response.WriteF ile

Browser will be forced (thanks to "attachment " word) to pop up a window
offering to save file or open it in application.
George.
"David C" <dl*****@lifeti meinc.comwrote in message
news:ef******* *******@TK2MSFT NGP06.phx.gbl.. .
>>>I have an internal asp.net 2.0 web application where we display the
contents of various files using Response.Conten tType and
Response.Wri teFile() settings and it works great for .doc, .xls, etc.
files. Now the users want to be able to open them in their native
programs (Microsoft Word, Excel, etc.). I have done this with ActiveX
before, but the company has moved to Office 2007 and I'm not sure the
same process will work for the new docx, xlsx, etc. files. Can anyone
give me some ideas on the best way to handle this? All users have
Microsoft Office. Thanks.

David



Jun 27 '08 #4
Nevermind. The problem was that I did not need "\" before and after
filename as I am using VB. When I took them off, it appears to work fine.
Thanks.

David
"George Ter-Saakov" <gt****@cardone .comwrote in message
news:uT******** ******@TK2MSFTN GP04.phx.gbl...
Show me the code.....

PS: There was a bug in IE 5.01 and it ignored the "attachment " .... But I
hope it's not the case here. Since we already have IE 7.

George.
"David C" <dl*****@lifeti meinc.comwrote in message
news:u4******** ******@TK2MSFTN GP06.phx.gbl...
>George,
Thank you for that info. However, it still does not open in the native
program (Microsoft Word, Microsoft Excel, etc.). It opens it in the
browser where it cannot be edited.

David
"George Ter-Saakov" <gt****@cardone .comwrote in message
news:%2******* *********@TK2MS FTNGP05.phx.gbl ...
>>You should add Content-Disposition to the header.
Like this Content-Disposition: attachment; filename="file. pdf"

So in C# code it's Response.AddHea der("Content-Disposition",
"attachment ; filename=\"file .pdf\"");
And then do Response.WriteF ile

Browser will be forced (thanks to "attachment " word) to pop up a window
offering to save file or open it in application.
George.
"David C" <dl*****@lifeti meinc.comwrote in message
news:ef****** ********@TK2MSF TNGP06.phx.gbl. ..
I have an internal asp.net 2.0 web application where we display the
contents of various files using Response.Conten tType and
Response.Wr iteFile() settings and it works great for .doc, .xls, etc.
files. Now the users want to be able to open them in their native
programs (Microsoft Word, Excel, etc.). I have done this with ActiveX
before, but the company has moved to Office 2007 and I'm not sure the
same process will work for the new docx, xlsx, etc. files. Can anyone
give me some ideas on the best way to handle this? All users have
Microsoft Office. Thanks.

David



Jun 27 '08 #5
George,
I did find a problem. Office 2007 opens a document from a previous version
of Office with a different name (e.g. it adds [1] to the name). For example,
if I open test.doc on a machine with office 2007 it opens it as test[1].doc
in a temporary directory. When it opens a file like test.docx it opens the
original. Is there any way to handle this? Thanks.

David
"George Ter-Saakov" <gt****@cardone .comwrote in message
news:uT******** ******@TK2MSFTN GP04.phx.gbl...
Show me the code.....

PS: There was a bug in IE 5.01 and it ignored the "attachment " .... But I
hope it's not the case here. Since we already have IE 7.

George.
"David C" <dl*****@lifeti meinc.comwrote in message
news:u4******** ******@TK2MSFTN GP06.phx.gbl...
>George,
Thank you for that info. However, it still does not open in the native
program (Microsoft Word, Microsoft Excel, etc.). It opens it in the
browser where it cannot be edited.

David
"George Ter-Saakov" <gt****@cardone .comwrote in message
news:%2******* *********@TK2MS FTNGP05.phx.gbl ...
>>You should add Content-Disposition to the header.
Like this Content-Disposition: attachment; filename="file. pdf"

So in C# code it's Response.AddHea der("Content-Disposition",
"attachment ; filename=\"file .pdf\"");
And then do Response.WriteF ile

Browser will be forced (thanks to "attachment " word) to pop up a window
offering to save file or open it in application.
George.
"David C" <dl*****@lifeti meinc.comwrote in message
news:ef****** ********@TK2MSF TNGP06.phx.gbl. ..
I have an internal asp.net 2.0 web application where we display the
contents of various files using Response.Conten tType and
Response.Wr iteFile() settings and it works great for .doc, .xls, etc.
files. Now the users want to be able to open them in their native
programs (Microsoft Word, Excel, etc.). I have done this with ActiveX
before, but the company has moved to Office 2007 and I'm not sure the
same process will work for the new docx, xlsx, etc. files. Can anyone
give me some ideas on the best way to handle this? All users have
Microsoft Office. Thanks.

David



Jun 27 '08 #6
Doubt that you can do anything here...
this is how Open/Save dialog works.....

If you choose "Save" then you can save it with the name you specified in
your "Content-Disposition" header.
If you choose "Open" IE will actually save the file into "TEMP" folder and
then open application (as if you double clicked on file). But if file with
that name already exists IE quietly appends [1] (or [2],...) to the name.

I do not know how to change that behavior andf most likely you can not....
George.

"David C" <dl*****@lifeti meinc.comwrote in message
news:OJ******** ******@TK2MSFTN GP06.phx.gbl...
George,
I did find a problem. Office 2007 opens a document from a previous
version of Office with a different name (e.g. it adds [1] to the name).
For example, if I open test.doc on a machine with office 2007 it opens it
as test[1].doc in a temporary directory. When it opens a file like
test.docx it opens the original. Is there any way to handle this?
Thanks.

David
"George Ter-Saakov" <gt****@cardone .comwrote in message
news:uT******** ******@TK2MSFTN GP04.phx.gbl...
>Show me the code.....

PS: There was a bug in IE 5.01 and it ignored the "attachment " .... But I
hope it's not the case here. Since we already have IE 7.

George.
"David C" <dl*****@lifeti meinc.comwrote in message
news:u4******* *******@TK2MSFT NGP06.phx.gbl.. .
>>George,
Thank you for that info. However, it still does not open in the native
program (Microsoft Word, Microsoft Excel, etc.). It opens it in the
browser where it cannot be edited.

David
"George Ter-Saakov" <gt****@cardone .comwrote in message
news:%2****** **********@TK2M SFTNGP05.phx.gb l...
You should add Content-Disposition to the header.
Like this Content-Disposition: attachment; filename="file. pdf"

So in C# code it's Response.AddHea der("Content-Disposition",
"attachmen t; filename=\"file .pdf\"");
And then do Response.WriteF ile

Browser will be forced (thanks to "attachment " word) to pop up a window
offering to save file or open it in application.
George.
"David C" <dl*****@lifeti meinc.comwrote in message
news:ef***** *********@TK2MS FTNGP06.phx.gbl ...
>I have an internal asp.net 2.0 web application where we display the
>contents of various files using Response.Conten tType and
>Response.W riteFile() settings and it works great for .doc, .xls, etc.
>files. Now the users want to be able to open them in their native
>programs (Microsoft Word, Excel, etc.). I have done this with ActiveX
>before, but the company has moved to Office 2007 and I'm not sure the
>same process will work for the new docx, xlsx, etc. files. Can anyone
>give me some ideas on the best way to handle this? All users have
>Microsof t Office. Thanks.
>
David
>




Jun 27 '08 #7
I think if you set the content-disposition to inline and the content-type to
the proper mime type and then stream it down with Response.WriteF ile or
BinaryWrite it will open automatically on it's application when you click
the link on a webpage.

As for using ActiveX, the process would be the same for any type of file
since you're just embedding the application on the webpage and letting it do
the rest.
"David C" <dl*****@lifeti meinc.comwrote in message
news:ef******** ******@TK2MSFTN GP06.phx.gbl...
>I have an internal asp.net 2.0 web application where we display the
contents of various files using Response.Conten tType and
Response.Write File() settings and it works great for .doc, .xls, etc.
files. Now the users want to be able to open them in their native programs
(Microsoft Word, Excel, etc.). I have done this with ActiveX before, but
the company has moved to Office 2007 and I'm not sure the same process will
work for the new docx, xlsx, etc. files. Can anyone give me some ideas on
the best way to handle this? All users have Microsoft Office. Thanks.

David

Jun 27 '08 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
4077
by: Chris | last post by:
Hi, - How can I open an existing word document from a C#-client and manipulate that document from within the C#-client ? - How can I open an excel document that is embedded in a word-document ? - How do I read the value of a cell within an Excel document ? I tried using a Word-OLB file (object library) that I set a reference to but can't find the right methods I need in order to execute the above.
10
4106
by: Woody Splawn | last post by:
I have been developing a ClientServer application on one machine at my office but the time has come to transfer it to the customer. The customer is running a Windows 2000 local area network. I will keep a copy of the applicaiton and all it's code on one of the client machines connected to the local area network at the customers. This machine has a full blown copy of Visual Studio 2003. SQL Server 2000 is the back-end, both at my office...
0
1247
by: Marco Singer | last post by:
Hi all, I want to create an Office automation client for Office 97 (and newer) which should automate Access, Excel and Word. On my developer computer I have Office XP installed. In KB244167 (INFO: Writing Automation Clients for Multiple Office Versions) Microsoft tells to use the type libraries of the oldest office version the client should run with. So I copied the type library files from a Office 97 installed on another
2
1808
by: NRakhesh | last post by:
I have to submit a project as a part of my final year project. I consulted various domains and finally decided to implement a work on delevoping a system for transcription work based company. The overall flow is somewhat like this the client either and indiviudal or a department is given access rights to a Toffice (transcription office) and adds files to his table and connects it through a web server (IIS) by generating XML files and...
5
2907
by: B1ackwater | last post by:
We've fooled around with Access a bit, but only using the single-user store-bought version. It seems to be a good database - versatile and infinitely programmable - and can apparently be used as a front end to SQL server if we ever needed to go that route. But - is there a client/server version of Access ? Looking on the CDW site there is a bewildering variety of packages and licences and such, but we can't figure out just which do...
11
2808
by: nn0410 | last post by:
I am about to deliver my first Access application to a client and am trying to do things "right" now, so as to make future maintenance as painless as possible for the client and myself. Following the initial delivery and installation, I'll be conducting ongoing development/maintenance on my premises, and then visiting the client's office periodically to install updates. Having never done this before, I'd greatly appreciate a reality...
11
2202
by: Wayne | last post by:
I am a one man enterprise and have been asked by a prospective client what happens to their database regarding ongoing changes etc if I get hit by a bus. Obviously my databases are distributed as mde files in an effort to protect my intellectual property. How do I give the client peace of mind, short of giving them a backup mdb file that any programmer could work on to provide required changes etc if I wasn't around? Of course this...
13
2155
by: John Kotuby | last post by:
I am expecting the answer to be, "of course not" or " are you kidding?", but maybe (hopefully) I am wrong and somebody can point me to an ingenious example of how the impossible just takes a little more work. TIA
8
1807
by: =?Utf-8?B?QmFkaXM=?= | last post by:
I have tried a server-side automation and it's giving me problems that I couldn't solve.. Now, I'm switching to client side automation and I was following this example: http://www.aspnetpro.com/NewsletterArticle/2003/09/asp200309so_l/asp200309so_l.asp but to get it working I had to "Go to the Security tab, select Local intranet, and click on the Custom Level button. Find the setting titled "Initialize and script ActiveX controls not marked...
11
7698
by: Bill Davy | last post by:
I am trying to edit Contacts in Outlook. This is so I can transfer numbers from my address book which is an Excel spreadsheet to my mobile phone. I came across the following snippet of code which enabled me to the contacts at least list. I had to root around to discover CdoDefaultFolderContacts (though it was guessable; how could I enumerate win32com.client.constants?). I now want to work through the Contacts in Outlook patching in...
0
8392
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8305
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,...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8603
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...
1
6163
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
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
4151
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
4301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.