473,406 Members | 2,387 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,406 software developers and data experts.

ContentType problem - downloading instead of displaying

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
should just display in my browser (as it does if I don't set the
ContentType).

I have appropriate MIME types set up in IIS (.vxml -->
application/voicexml+xml).

What am I doing wrong here? And more important, how can I fix it?

TIA,
BG
Nov 18 '05 #1
8 2023
i think the problem is that the mime type is not associated with your
browser it is rather associated with your vs.net

try looking up the file types under folder options. remove the association
with vs.net and then try.

Hope this helps,

HD

"Bryan Glennon" <br***@bpgc.com> wrote in message
news:MP************************@msnews.microsoft.c om...
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
should just display in my browser (as it does if I don't set the
ContentType).

I have appropriate MIME types set up in IIS (.vxml -->
application/voicexml+xml).

What am I doing wrong here? And more important, how can I fix it?

TIA,
BG

Nov 18 '05 #2
I checked that. VXML is not associated with VS.NET...

In article <uQ**************@TK2MSFTNGP12.phx.gbl>,
he************@CAPS.AND.DOTS.hotmail.com says...
i think the problem is that the mime type is not associated with your
browser it is rather associated with your vs.net

try looking up the file types under folder options. remove the association
with vs.net and then try.

Hope this helps,

HD

"Bryan Glennon" <br***@bpgc.com> wrote in message
news:MP************************@msnews.microsoft.c om...
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
should just display in my browser (as it does if I don't set the
ContentType).

I have appropriate MIME types set up in IIS (.vxml -->
application/voicexml+xml).

What am I doing wrong here? And more important, how can I fix it?

TIA,
BG


Nov 18 '05 #3
Hi Bryan Glennon,
Thank you for using Microsoft Newsgroup service. Based on your description,
you have an aspx
page which is to show a VXML file for the user to download or open? Also,
you've add the the
mime type in the IIS. However, when you run the page and click the "open"
button on the downdload
dialog, you found that the vxml file was opened in the VS.NET rather than
the tool confitgured in
the Folder options? Please correct me if my understanding of your problem
is not quite accureate.

If my understanding is true, here is some suggestion:

In asp.net, if you want to show a certain type of data to the client and
want it to be display or downloaded,
you can use the following code:

private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
string name = "VXML.vxml"; //VXML.vxml is a vxml file on the server
Response.Clear();
Response.AppendHeader( "content-disposition","attachment; filename=" +
name );
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.ContentType = "application/voicexml+xml";
Response.WriteFile(Server.MapPath(name));
Response.End();

}

In addition to setting the "Response.ContentType", you need also use the
"Response.AppendHeader" or "Response.AddHeader" to
add a header element into the response output stream. And the
"content-disposition" attribute will force the download dialog
to popup. Also, this header element will let the client side to choose the
proper tool to deal with the response output stream(doucment).
For more information about the "Content-Disposition" Header Field, you can
visit the following web link:
http://xml.resource.org/public/rfc/h...3.html#anchor2
I've tested the code on my side, when didn't add "Response.AppendHeader(
"content-disposition","attachment; filename=" + name )"
the vxml document did will be opended by the VS.NET. If add it, when load
the file in browser, the file will be opened by the tool you specified
in the Folder options's file association. If nothing is specified in the
client side 's file association(with the "vxml), there will popup the
dialog to let you choose a tool or webservice to open it.
Please try out the preceding suggestion to see whether it helps. Also if
you have any questions on it, please feel free to let me know.
Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Nov 18 '05 #4
Hi Bryan Glennon,
Have you had a chance to try my suggestion or is your problem resolved ?
Please let me know if you need any help.

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #5
Steven -
I did try it, and it works as you describe, but I need the vxml to
open in IE, and I can't make that happen.

(Sorry for taking so long to get back to you, but I was out of town
for a while)

Thanks for the help,
Bryan

In article <dz**************@cpmsftngxa07.phx.gbl>, v-
sc****@online.microsoft.com says...
Hi Bryan Glennon,
Have you had a chance to try my suggestion or is your problem resolved ?
Please let me know if you need any help.

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #6
Hi Bryan,

Thank you for the response. Based on your description in the last reply.
You'd like the VXML file to be displayed in IE, yes?
I think if you just want to display the vxml file in IE(without popup the
file download dialog) when the browser navigate to it, you can just set the
ContentType as "text/xml", then the vxml will be displayed in IE as a xml
document. For example:
Response.ContentType = "text/xml";

However, if you do need to set the ContentType as
"application/voicexml+xml", then, this is a particular document type that
the IE doesn't support by default. So if the response returned such
ContentType, the client will search for the most proper tools to open it.
Such as VS.NET or other ones(of course, this can be specified in client),
but the server side can't specify how the document is opened in client.

If you have any questions on it, please feel free to let me know.
Happy New year!

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #7
Steven -
I'm not sure there is a way around this. The basic issue is that for
execution on our voice platform, they type should be set to
application/voicexml+xml. But when I'm debugging, I like to be able to
see the vxml in my browser rather than having to listen to it being
processed on the voice platform.

Thanks again for the help, and have a great new year.

-Bryan
In article <fu**************@cpmsftngxa07.phx.gbl>, v-
sc****@online.microsoft.com says...
Hi Bryan,

Thank you for the response. Based on your description in the last reply.
You'd like the VXML file to be displayed in IE, yes?
I think if you just want to display the vxml file in IE(without popup the
file download dialog) when the browser navigate to it, you can just set the
ContentType as "text/xml", then the vxml will be displayed in IE as a xml
document. For example:
Response.ContentType = "text/xml";

However, if you do need to set the ContentType as
"application/voicexml+xml", then, this is a particular document type that
the IE doesn't support by default. So if the response returned such
ContentType, the client will search for the most proper tools to open it.
Such as VS.NET or other ones(of course, this can be specified in client),
but the server side can't specify how the document is opened in client.

If you have any questions on it, please feel free to let me know.
Happy New year!

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #8
Hi Bryan,

Thanks for your response. Yes, sometimes we need different display style in
debuging time and deplyment time. However, in our issue, since how the
document displayed in the browser depends on the ContentType, we'd have to
use different ContentType if at debug and deploy time if we want the
different style it shows. Maybe you can workaround this way if you think it
possbile. Any way, thanks again for your wish.

If you have any questions, please feel free to let me know. Have a greate
New year, too.
Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #9

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

Similar topics

3
by: Marc | last post by:
Hello, I have a page with lots of thumbnails of photos. I want the user to be able to dload a big version of the photo (also present on the server) by either 1) clicking on it (left...
3
by: S.W. Rasmussen | last post by:
Handling file downloading with Randy Birch very nice code (http://vbnet.mvps.org/code/internet/ftpdofiledownload.htm) raises a second question: I my case, the user should not be allowed to...
4
by: Luke StClair | last post by:
Only marginally belonging in this newsgroup... but oh well. I've just started writing in python, and I want to make the files available on the web. So I did the standard <a...
0
by: Eyal Zinder | last post by:
Hello to all.. I'm trying to format an excel page by creating html tables on the fly through Response.ContentType = "application/vnd.ms-excel" . I now produce reports in html format by processing...
2
by: CVerma | last post by:
I'm using an html input control (System.web.UI.HTMLControls.HTMLInputFile) to upload files such as msword, excel, jpg, and pdf. I have the encType property set in the form:...
2
by: Stephen Walch | last post by:
I have seen many examples on the web for downloading attachments ffrom ASP.NET forms using response.WriteBinary, but they all use hard-coded ContentTypes (for example, Response.ContentType =...
1
by: sonic | last post by:
Hi, I am able to display my document with contenttype="applicaton/msword" this requires that the content be marked up in html style.. i wanted to also try displaying it as RTF, so i could use...
1
by: gts | last post by:
Hello, I'm putting together a page with some links to videos. One link plays the video and the other is supposed to allow the user to download the file by forcing the "save as" box. For the download...
4
by: Bjorn Sagbakken | last post by:
With ASP.NET 2.0 I'm trying to display the pdf file directly in the client browser, but I only get a download dialogue box. Downloading the file works fine, but I want to view the PDF directly. ...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
0
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,...
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...
0
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,...
0
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...

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.