Encrypting a download on the fly

P

Paul Rogers

Hi, im wanting to outpout a binary file from ASP, but encrypt it on the fly
according to a given seed (retrieved according to the users login).
But ive fallen at the first hurdle, and cant even seem to get access to the
raw bytes of the file as I pass it through. The code I have written is thus:

----------------

objStream.LoadFromFile( "D:\\" + filename );

//Output the contents of the stream object
Response.ContentType = "application/none";
Response.AddHeader( "Content-disposition", "inline; filename="+filename );
Response.AddHeader( "Content-Length", objStream.Size );

// reset the stream back to 0
var index;
objStream.Position = 0;

while (objStream.Position < objStream.Size)
{
var testbyte;
var ibound;

testbytes = objStream.Read(1000);
ibound = 0;

Response.Write(testbyte);

while (ibound < ubound(testbyte))
{
Response.WriteBinary(testbyte(ibound));
ibound = ibound + 1;
}
}

----------------

This code isnt supposed to do anything other than pass the bytes back (in a
convulted way) which i will later turn into encryption. But I can access the
raw bytes using testbyte(ibound) it seems. Will someone please enlighten me,
Ive spent all night fighting HTTP 500 errors :(

Thanks

Paul
 
S

Scott

Your first line may be causing you some grief...

objStream.LoadFromFile( "D:\\" + filename );

I guessing it should be:

objStream.LoadFromFile( "D:\" + filename );

Not sure if that helps?!?!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,141
Messages
2,570,817
Members
47,364
Latest member
Stevanida

Latest Threads

Top