473,385 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Protecting documents

Hi.
I have a folder that contains a lot of different documents. xls, .doc, .pdf
etc. Different users have access to different documents. The problem is
that if a user knows the name of a document then he can just write the path
into IE and get access to it anyway. Is it possible to prevent this?

Thanks,
Shawn
Nov 18 '05 #1
7 1438
Shawn,

If it's required that people be able to download these (which I'm sure it
is), your best bet is to store them on the file system where they are
inaccessible directly. You can then use Response.BinaryWrite to stream
them down to the browser when legitimate.

Here's a small code sample that demonstrates a PDF file loaded both inline
and outside fo the browser.

Dim fs As New FileStream("c:\directory\books.pdf"),
FileMode.OpenOrCreate, FileAccess.Read)
Dim MyData(fs.Length) As Byte
fs.Read(MyData, 0, fs.Length)
Response.Buffer = True
Response.Clear()
Response.ContentType = "application/pdf"

' Opens it outside browser
Response.AddHeader("content-disposition", "attachment;
filename=books.pdf")

' Opens it inside browser
'Response.AddHeader("content-disposition", "inline;
filename=books.pdf")

Response.BinaryWrite(MyData)
Response.End()
Hope that helps.
Jim Cheshire, MCSE, MCSD [MSFT]
Developer Support
ASP.NET
ja******@online.microsoft.com

This post is provided as-is with no warranties and confers no rights.

--------------------
From: "Shawn" <bo********@hotmail.com>
Subject: Protecting documents
Date: Fri, 21 Nov 2003 13:20:58 +0100
Lines: 10
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <OH**************@TK2MSFTNGP10.phx.gbl>
Newsgroups: microsoft.public.dotnet.framework.aspnet
NNTP-Posting-Host: pc3.akermaritime.no 193.161.152.243
Path: cpmsftngxa07.phx.gbl!cpmsftngxa10.phx.gbl!cpmsftng xa06.phx.gbl!TK2MSFTNGP08.
phx.gbl!TK2MSFTNGP10.phx.gblXref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.framework.aspnet:191817
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

Hi.
I have a folder that contains a lot of different documents. xls, .doc, .pdf
etc. Different users have access to different documents. The problem is
that if a user knows the name of a document then he can just write the path
into IE and get access to it anyway. Is it possible to prevent this?

Thanks,
Shawn


Nov 18 '05 #2
Shawn,

If you set the column to visible="false" you will still be able to access it
in the code-behind. If you need to access its value from the client, then
you are correct you can't set visible="false".

If the latter is the case (you need to access the value from the client
code) you could try using <div> tags around it and setting it's visibility
with CSS.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"Shawn" <bo********@hotmail.com> wrote in message
news:OH**************@TK2MSFTNGP10.phx.gbl...
Hi.
I have a folder that contains a lot of different documents. xls, .doc, ..pdf etc. Different users have access to different documents. The problem is
that if a user knows the name of a document then he can just write the path into IE and get access to it anyway. Is it possible to prevent this?

Thanks,
Shawn

Nov 18 '05 #3
Shawn,

Sorry.

I was attempting to post to the message above yours.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"S. Justin Gengo" <sj*****@aboutfortunate.com> wrote in message
news:eW*************@tk2msftngp13.phx.gbl...
Shawn,

If you set the column to visible="false" you will still be able to access it in the code-behind. If you need to access its value from the client, then
you are correct you can't set visible="false".

If the latter is the case (you need to access the value from the client
code) you could try using <div> tags around it and setting it's visibility
with CSS.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"Shawn" <bo********@hotmail.com> wrote in message
news:OH**************@TK2MSFTNGP10.phx.gbl...
Hi.
I have a folder that contains a lot of different documents. xls, .doc,

.pdf
etc. Different users have access to different documents. The problem is that if a user knows the name of a document then he can just write the

path
into IE and get access to it anyway. Is it possible to prevent this?

Thanks,
Shawn


Nov 18 '05 #4
Didn't quite understand what column visibility had to do with protecting
document folders :-)

"S. Justin Gengo" <sj*****@aboutfortunate.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Shawn,

Sorry.

I was attempting to post to the message above yours.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"S. Justin Gengo" <sj*****@aboutfortunate.com> wrote in message
news:eW*************@tk2msftngp13.phx.gbl...
Shawn,

If you set the column to visible="false" you will still be able to access it in the code-behind. If you need to access its value from the client, then
you are correct you can't set visible="false".

If the latter is the case (you need to access the value from the client
code) you could try using <div> tags around it and setting it's visibility
with CSS.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"Shawn" <bo********@hotmail.com> wrote in message
news:OH**************@TK2MSFTNGP10.phx.gbl...
Hi.
I have a folder that contains a lot of different documents. xls, .doc,

.pdf
etc. Different users have access to different documents. The problem is that if a user knows the name of a document then he can just write the

path
into IE and get access to it anyway. Is it possible to prevent this?

Thanks,
Shawn



Nov 18 '05 #5
You can do this 2 ways.

One, Jim's way.

The other is to srode diffrent file types in diffrent folders and then configure
diferent web.config files with the user's on each folder.

Joao Cardoso (MVP dotNET)
================================================== =====
[LusoCoders]- http://groups.yahoo.com/group/lusocoders/
[PontoNetPT]- http://www.programando.net/regras.aspx
jj***@acinet.pt.n.o-s.p-a.m - www.acinet.pt
================================================== =====
Nov 18 '05 #6
Joao,

That will work as long as the file type you are requesting is mapped to the
aspnet_isapi.dll. It's not recommended to map all of these file types to
ASP.NET.

Jim Cheshire, MCSE, MCSD [MSFT]
Developer Support
ASP.NET
ja******@online.microsoft.com

This post is provided as-is with no warranties and confers no rights.
--------------------
From: "Joao S Cardoso [MVP]" <jj***@acinet.pt.n-o.s-p.a-m>
Subject: Re: Protecting documents
Date: Fri, 21 Nov 2003 16:26:46 +0000
Message-ID: <t2********************************@4ax.com>
References: <OH**************@TK2MSFTNGP10.phx.gbl>
X-Newsreader: Forte Agent 1.93/32.576 English (American)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Newsgroups: microsoft.public.dotnet.framework.aspnet
NNTP-Posting-Host: 213.13.118.94
Lines: 1
Path: cpmsftngxa07.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTN GXA05.phx.gbl!TK2MSFTNGP08
..phx.gbl!TK2MSFTNGP11.phx.gblXref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.framework.aspnet:191904
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

You can do this 2 ways.

One, Jim's way.

The other is to srode diffrent file types in diffrent folders and then configurediferent web.config files with the user's on each folder.

Joao Cardoso (MVP dotNET)
================================================= ======
[LusoCoders]- http://groups.yahoo.com/group/lusocoders/
[PontoNetPT]- http://www.programando.net/regras.aspx
jj***@acinet.pt.n.o-s.p-a.m - www.acinet.pt
================================================= ======


Nov 18 '05 #7
>Joao,

That will work as long as the file type you are requesting is mapped to the
aspnet_isapi.dll. It's not recommended to map all of these file types to
ASP.NET.


Hi... ur right...

I just remember something... if he is using windows authentication perhaps is as
easy as changing the security settings for diffrent folders....

But still your way seems that will be the best for this scenario.

Joao Cardoso (MVP dotNET)
================================================== =====
[LusoCoders]- http://groups.yahoo.com/group/lusocoders/
[PontoNetPT]- http://www.programando.net/regras.aspx
jj***@acinet.pt.n.o-s.p-a.m - www.acinet.pt
================================================== =====
Nov 18 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

24
by: Yang Li Ke | last post by:
Hi guys! Anyone know a way so that users purchasing my scripts would not be able to share them with other people ? Yang
3
by: StevePBurgess | last post by:
I have a data driven website. Part of the website is a downloads section - all the downloads are help in a folder called "downloads". When a general user (i.e. one that doesn't have a log in) uses...
6
by: nell | last post by:
Hi all, I've developed a testing application in python, and should supply it in a way that no one (lets say they are regular users) will understand it and edit it. The application source is all...
12
by: Roland Hall | last post by:
I read Aaron's article: http://www.aspfaq.com/show.asp?id=2276 re: protecting images from linked to by other sites. There is a link at the bottom of that page that references an interesting...
1
by: darrel | last post by:
I have a section of our site that I'm putting behind a password. The template checks to see if a cookie was set, if not, it sends you to the login page, where you enter in the pwd, and it sets...
6
by: Roman Werpachowski | last post by:
In a recent thread http://tinyurl.com/8n7fe I asked about preventing the user from deleting the object pointed to by a pointer/reference. Now I would like to ask about a different aspect of this...
1
by: nitinpatel1117 | last post by:
Hi all, I have a question regarding the protection of software that has been built inhouse. Basically, i've built an inhouse CMS using PHP, all web builds that were done for our clients were...
3
by: Porkie999 | last post by:
-----------------------------------------------------------------------QUESTION hi i am really stuck with this and its only a small problem. i want to be able to type ......... dsfsjfjsjjfs in...
6
by: Andy B | last post by:
Is there a way that is already built into .net 3.5 that will let me protect an object from being modified when the object is public?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.