From: Dean g on
Hi,
I need help stoping people from accessing documents on the
server unless they are logged in through the website. I don't
know how to do this without using a database or just manually
added passwords to folders.

I know its possible in .net, any help on how to do this in
classic asp would be greatly appreciated.

Regards,
Dean



*** Sent via Developersdex http://www.developersdex.com ***
From: Bwig Zomberi on
Dean g wrote:
> Hi,
> I need help stoping people from accessing documents on the
> server unless they are logged in through the website. I don't
> know how to do this without using a database or just manually
> added passwords to folders.
>
> I know its possible in .net, any help on how to do this in
> classic asp would be greatly appreciated.
>
> Regards,
> Dean
>
>
>
> *** Sent via Developersdex http://www.developersdex.com ***


After authenticating the user, read the file contents and then

1. Use Response.ContentType to set mime type.

2. Use Response.AddHeader to set file name
Response.AddHeader "content-disposition","attachment;
filename=fname.ext"

3. Use Response.BinaryWrite to send the file to the browser.

--
Bwig Zomberi
From: Dean g on

Thanks for the help Bwig


*** Sent via Developersdex http://www.developersdex.com ***
From: Dan on

"Dean g" <big_deanus(a)hotmail.com> wrote in message
news:uHBn3u26KHA.1888(a)TK2MSFTNGP05.phx.gbl...
>
> Thanks for the help Bwig

Just a note though - if the file is large, you may have to send it out in
chunks instead of all in one go. If you Google for "ado stream binarywrite"
you'll find plenty of examples of how to do this in ASP.

--
Dan

From: Dean g on
Thanks for the help guys, i have a new problem with this
though hopefully you can help with.

I can't get the documents to open in the browser, they
automatically save. Ideally i would like to open the files in
a popup window if thats possible.

my code looks like this, the inline just ins't doing anything.

Response.AddHeader "Content-Disposition","inline; filename="&
file

Regards,
Dean g

*** Sent via Developersdex http://www.developersdex.com ***