Feb 23, 2012, 12:20 PM
[CLOSED] File Download is not working and getting BADRESPONSE
Hi,
I am trying to save file to local machine from web site. I have implement small file save functionality, but I am getting error like Status Code : 200 and Status Text : BADRESPONSE Expected ')'. I don't think the error ')' is in the file. The file content is small one as showing below...
EH ATLOS YYYY02DDENV_CONTROL_NO
TH TRANSACTION_IDTRANS_CONTROL_NO
This above text saved as "Amaral78.fnm" in the folder where web page exist. I am giving small example here ...
I am trying to save file to local machine from web site. I have implement small file save functionality, but I am getting error like Status Code : 200 and Status Text : BADRESPONSE Expected ')'. I don't think the error ')' is in the file. The file content is small one as showing below...
EH ATLOS YYYY02DDENV_CONTROL_NO
TH TRANSACTION_IDTRANS_CONTROL_NO
This above text saved as "Amaral78.fnm" in the folder where web page exist. I am giving small example here ...
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="ExtExportFile.aspx.vb" Inherits="Testing_ExtExportFile" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager ID="resMngr" runat="server" />
<ext:Button ID="btnExport" runat="server" Text="Export File">
<DirectEvents>
<Click OnEvent="ExportFile">
</Click>
</DirectEvents>
</ext:Button>
</form>
</body>
</html>
and Code behind...Imports Ext.Net
Partial Class Testing_ExtExportFile
Inherits System.Web.UI.Page
Public Sub ExportFile(ByVal sender As Object, ByVal e As DirectEventArgs)
Dim sDataFile As String = Server.MapPath("Amaral78.fnm")
HttpContext.Current.Response.ContentType = "application/octet-stream"
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=test.fnm")
HttpContext.Current.Response.WriteFile(sDataFile)
HttpContext.Current.Response.End()
End Sub
End Class
Please let me know where I have to modify?
Last edited by Daniil; Feb 23, 2012 at 2:24 PM.
Reason: [CLOSED]