I looked more into this and it may be a result of the way you're opening and closing your streams (not sure without seeing the rest of the code. Try adding response.AddHeader("Content-Disposition", "attachment filename=PY75.xls") Update 2: After upgrading IE 9, content-disposition is finally working and can download from web api. Any idea how to fix this problem? Why IE can't recognize content-disposition header? If I commented like above, IE can download the file with id as its default file name but it cannot like what described above when uncommenting above. = new ContentDispositionHeaderValue("attachment") = new MediaTypeHeaderValue("application/vnd.ms-excel") Response.Content = new StreamContent(result) HttpResponseMessage response = new HttpResponseMessage() Update 1: According to my debugging, it was not cache, but `ContentDisposition' in following code. But in MVC 4, I found there is no property "Cache" in HttpResponseMessage nor any way to set private cache. So I want to set private cache in that download. The requested site is either unavailable or cannot be found."Īccording to IE 8 and client-side caching, it looks like that no-cache setting causes the problem. The browser says "Unable to open this internet site. But one problem is that IE can't download a file from a web api while chrome and firefox can. I have a ASP.NET MVC 4 application with Web API.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |