Download .wav file from asp.net in Internet Explorer

I am just trying to send a WAV file to Internet Explorer using the ASP.net handler:

public void ProcessRequest(HttpContext context)
{
    HttpResponse response = context.Response;
    response.ContentType = "audio/x-wav";
    response.WriteFile("MyWav.wav");
    response.AddHeader("Content-Length", "304578");

    response.Flush();
}

This works for Firefox and Chrome, but I just got a blank screen in Internet Explorer. What for?

(I tried to set the “Content-Disposition” header. If I set it to “attachment”, I will be presented with a download dialog. If I set it to “inline”, I will just get a blank page, as before.

+3
source share
2 answers

You can try to embed it in an object

<object
classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95">
<param name="AutoStart" value="1" />
<param name="FileName" value="GiveYourPageNameHere.aspx" />
</object>

, wav , , , .

+1

, IE HTTP, URL- .wav, .

URL- /foo/bar.wav?audioId=123 /foo/baz?audioId=123. IE, .wav.

0

Source: https://habr.com/ru/post/1753624/


All Articles