How to protect files in a hosted environment?

G

Guest

How do you protect files (such as .PDF) in a hosted (Interland) environment
when you have no access to IIS?
 
G

Guest

The problem with the article is that you have to muck about with IIS. I don't
have that option in a hosted environment. Also, there is no protected
database subdirectory.
 
J

Joshua Flanagan

I don't think the ForbiddenHandler will work, since he does not have
access to IIS (to map file types to the ASPNET ISAPI).

The only solution I can think of is to store the files as binary data in
a database. SQL Server and Oracle have specifica column types for this
purpose. You would then create a custom httphandler (.ashx file, since
you cannot map a new file type) that handles retrieving the file data
from the database and sending it to the Response output stream. You can
figure out which file to retrieve using a querystring.

So:
http://myserver/application/Instructions.pdf
becomes:
http://myserver/application/FileLoader.ashx?file=Instructions.pdf
or:
http://myserver/application/FileLoader.ashx?fileID=110 (where 110 is an
ID column in the database that identifies the Instructions.pdf file).

Note, in the databse table, you will want to at least store the
filename, file contents (binary), and content type (so that you can set
the Response.ContentType when you return the data).


Joshua Flanagan
http://flimflan.com/blog
 
K

Kevin Spencer

Protect them from whom? Do you have access to anyone else's hosted files on
the server? If not, what makes you think anyone else has access to yours?
And if nobody has access, in what way do you need to additionally protect
them?

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.
 

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,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top