473,387 Members | 1,621 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

ContentType

Hello to all.

I'm trying to diplay word, exel and pdf documentes inside the ie window.
To show a pdf file i know that i have to set the property ContentType =
"application/pdf". But I was unable to find the value to display exel files.
Does ny one know what correct value to show this kind of values?
Thanks in advance
Feb 3 '06 #1
5 1605
application/octet-stream

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Who is Mighty Abbott?
A twin turret scalawag.

"Henrry Pires" <Nelson@Don'tuse.com> wrote in message
news:ul**************@TK2MSFTNGP09.phx.gbl...
Hello to all.

I'm trying to diplay word, exel and pdf documentes inside the ie window.
To show a pdf file i know that i have to set the property ContentType =
"application/pdf". But I was unable to find the value to display exel
files. Does ny one know what correct value to show this kind of values?
Thanks in advance

Feb 3 '06 #2
It dosn't work. when I put that it try to download the page (my aspx page).
Stange.
"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:%2***************@TK2MSFTNGP09.phx.gbl...
application/octet-stream

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Who is Mighty Abbott?
A twin turret scalawag.

"Henrry Pires" <Nelson@Don'tuse.com> wrote in message
news:ul**************@TK2MSFTNGP09.phx.gbl...
Hello to all.

I'm trying to diplay word, exel and pdf documentes inside the ie window.
To show a pdf file i know that i have to set the property ContentType =
"application/pdf". But I was unable to find the value to display exel
files. Does ny one know what correct value to show this kind of values?
Thanks in advance


Feb 3 '06 #3
try this: this.Response.ContentType = "application/vnd.ms-excel"
"Henrry Pires" <Nelson@Don'tuse.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
It dosn't work. when I put that it try to download the page (my aspx
page). Stange.
"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:%2***************@TK2MSFTNGP09.phx.gbl...
application/octet-stream

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Who is Mighty Abbott?
A twin turret scalawag.

"Henrry Pires" <Nelson@Don'tuse.com> wrote in message
news:ul**************@TK2MSFTNGP09.phx.gbl...
Hello to all.

I'm trying to diplay word, exel and pdf documentes inside the ie window.
To show a pdf file i know that i have to set the property ContentType =
"application/pdf". But I was unable to find the value to display exel
files. Does ny one know what correct value to show this kind of values?
Thanks in advance



Feb 3 '06 #4
That's right. My apologies. While the content-type is correct for any type
of binary file stream, the file name is not identified, and therefore, the
browser can't identify the file.

The problem here is that the MIME type for an Excel Spreadsheet might or
might not be recognized by the browser. A browser can identify a file type
by either of 2 things: content-type header, and file name. Since the file
has a .aspx extension, the browser can't know what the type is from the
extension.

What I omitted was the Content-Dispostion header, which indicates the name
of the file. The following article details how to do this:

http://www.dotnetspider.com/technology/kbpages/553.aspx

The salient code in the article is as follows:

Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-Disposition", "Filename=Requirements.doc" );

Of course, in your case, it would be the file name with an "xls" extension.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Who is Mighty Abbott?
A twin turret scalawag.
"Henrry Pires" <Nelson@Don'tuse.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
It dosn't work. when I put that it try to download the page (my aspx
page). Stange.
"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:%2***************@TK2MSFTNGP09.phx.gbl...
application/octet-stream

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Who is Mighty Abbott?
A twin turret scalawag.

"Henrry Pires" <Nelson@Don'tuse.com> wrote in message
news:ul**************@TK2MSFTNGP09.phx.gbl...
Hello to all.

I'm trying to diplay word, exel and pdf documentes inside the ie window.
To show a pdf file i know that i have to set the property ContentType =
"application/pdf". But I was unable to find the value to display exel
files. Does ny one know what correct value to show this kind of values?
Thanks in advance



Feb 4 '06 #5
Thnka it works fine.
Many thanks :-)
Feb 6 '06 #6

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

Similar topics

3
by: MJ | last post by:
I'm trying to stream the contenttype of "application/x-java-jnlp-file" via asp.net/c#, but the client only sees it as a plain text file. Example: Response.Clear(); Response.ClearHeader();...
5
by: TJS | last post by:
trying to display pdf file in browser fails on this line: Response.ContentType = "application/pdf" getting an error about no declaration found for "response" what declaration is needed ???
8
by: Bryan Glennon | last post by:
I have an aspx page. If I set the Response.ContentType = "application/voicexml+xml" then when I load browse to the page it downloads the file and opens .Net Studio to allow me to edit it. It...
0
by: Sean Kraft | last post by:
Hello, I am generating a PDF and writing its bytes to the browser using Response.BinaryWrite(). Before I do this I set the response.contenttype = "application/pdf". When I run in debug I see...
3
by: darrel | last post by:
I'm creating a tool for people to upload an image and have it resized on the server. I'm checking to first see if the image is a JPG, GIF, BMP or TIF file. I'm having a problem with the TIF files,...
7
by: darrel | last post by:
I'm creating a file upload tool, and want to allow only DOC, XLS, PDF, RTF or TXT files. I am using this to check: if (contentType = "application/msword") _ or (contentType = "application/rtf")...
3
by: ad | last post by:
I create a MemoryStream form a dataset: MemoryStream sm= new MemoryStream(); dsHealth.WriteXml(sm); I use Response.Write() to send this XML MemoryStream as file to client. What is the...
8
by: Katie | last post by:
Hi, I am trying to set the content type and header for the response object but for some reason it doesnt set it. I tried it on dev and it worked fine but didnot on production. The difference is...
0
by: scottf35 | last post by:
Hi, I am working on (read that - upgrading) an application. This application creates an HTTPWebRequest object, populates it with values which are then sucked out of the Request.Form object (eg...
1
by: rguarnieri | last post by:
Hi!, I'm using Visual Studio 6.0 and I'm trying to open an asp page like a .pdf file, I used Response.ContentType="application/pdf" in my asp page but it doesn't work This is an example: <%@...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.