Aug 10, 2009, 7:50 AM
Download file in MVC project
Hi,
I'm using Coolite 0.8 in my MVC project. In my project, I'm trying to download generated report (in excel format) but it always return the following error:
Status code: 200
Status text: BADRESPONSE: Syntax error
BTW, here's the code..
I'm using Coolite 0.8 in my MVC project. In my project, I'm trying to download generated report (in excel format) but it always return the following error:
Status code: 200
Status text: BADRESPONSE: Syntax error
BTW, here's the code..
<ext:Button ID="Button1" runat="server" Text="Download Report" Icon="PageExcel">
<AjaxEvents >
<Click Url="\Report\report1" IsUpload="true" />
</AjaxEvents>
</ext:Button>
In Report1 basically it's a view which generate the excel file;
<%@ Page Language="VB" Inherits="System.Web.Mvc.ViewPage" %>
<%
Response.Buffer = True
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader("content-disposition", "inline; filename=report1.xls")
%>
<html xmlns:x="urn:schemas-microsoft-com:office:excel" >
<head>
<% Response.Write("<!--[if gte mso 9]>")%>
<xml><x:ExcelWorkbook>
<x:ExcelWorksheets>
<x:ExcelWorksheet>
<x:Name><% Response.Write(Year(Now()) & "-" & Month(Now()) & "-" & Day(Now())) %></x:Name>
<x:WorksheetOptions>
<x:Print>
<x:ValidPrinterInfo/>
</x:Print>
</x:WorksheetOptions>
</x:ExcelWorksheet>
</x:ExcelWorkbook>
</xml>
<% Response.Write("<![endif]-->")%>
<title>Repor1</title>
</head>
<body>
Hello World!
</body>
</html>
<%
Response.Flush()
Response.End()
%>
Any advise?