Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

/proc/kallsyms format, sqldatasource dal, wwwxxxenden, convert raid5 to raid 10 mdadm, apache force chunked, nrao wwwxxx, xxxxxdup, procmail change subject header, wwwXxx not20, Wwwxxx.doks sas

Links

XODOX
Impressum

#1: Client and Office from asp.net

Posted on 2008-04-24 20:19:32 by David C

I have an internal asp.net 2.0 web application where we display the contents
of various files using Response.ContentType and Response.WriteFile()
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

Report this message

#2: Re: Client and Office from asp.net

Posted on 2008-04-24 20:38:43 by George Ter-Saakov

You should add Content-Disposition to the header.
Like this Content-Disposition: attachment; filename="file.pdf"

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

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" <dlchase@lifetimeinc.com> wrote in message
news:efUJQgjpIHA.4620@TK2MSFTNGP06.phx.gbl...
>I have an internal asp.net 2.0 web application where we display the
>contents of various files using Response.ContentType and
>Response.WriteFile() 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
>

Report this message