I
iporter
I use the code below to authorise the download of certain files.
Thus, instead of linking to the file in a wwwroot directory, I link to
this code with the filename as a parameter, and the script streams the
file if the user is authorised.
This has worked fine on PDFs, DOCs, XLS, etc. until today, and 18MB
file presents the error message 'format error: not a pdf or corrupt'.
Is there a file size limit, or a default that needs overridden? Any
thoughts?
Cheers.
The Code:
<%@ language="javascript"%>
<%
if (Session("UserID") == 0) {
Response.Redirect("notauthorized.asp");
} else {
Response.ContentType = "application/x-unknown";
var fn = Request.QueryString("fn");
// Response.Write(fn);
// Response.End();
// fn = "ecpa_efficacy_minutes_08_11_06.pdf"
var FPath = "E:\\Inetpub\\irac-online.org\\documents\\" + fn;
Response.AddHeader("Content-Disposition","attachment; filename=" +
fn);
var adoStream = Server.CreateObject("ADODB.Stream");
adoStream.Open();
adoStream.Type = 1;
adoStream.LoadFromFile(FPath);
Response.BinaryWrite(adoStream.Read());
adoStream.Close();
adoStream = null;
Response.End();
}
%>
Thus, instead of linking to the file in a wwwroot directory, I link to
this code with the filename as a parameter, and the script streams the
file if the user is authorised.
This has worked fine on PDFs, DOCs, XLS, etc. until today, and 18MB
file presents the error message 'format error: not a pdf or corrupt'.
Is there a file size limit, or a default that needs overridden? Any
thoughts?
Cheers.
The Code:
<%@ language="javascript"%>
<%
if (Session("UserID") == 0) {
Response.Redirect("notauthorized.asp");
} else {
Response.ContentType = "application/x-unknown";
var fn = Request.QueryString("fn");
// Response.Write(fn);
// Response.End();
// fn = "ecpa_efficacy_minutes_08_11_06.pdf"
var FPath = "E:\\Inetpub\\irac-online.org\\documents\\" + fn;
Response.AddHeader("Content-Disposition","attachment; filename=" +
fn);
var adoStream = Server.CreateObject("ADODB.Stream");
adoStream.Open();
adoStream.Type = 1;
adoStream.LoadFromFile(FPath);
Response.BinaryWrite(adoStream.Read());
adoStream.Close();
adoStream = null;
Response.End();
}
%>