find out if the user has enough rights to open a page

C

Corno

Hi all,

How do I find out if the current visitor of my page has enough rights to
open another page on the same server?
I need this to show a link to that page only when the visitor can actually
visit that page and will not get an 'access denied' message.

IOW, I'm looking for the implementation of the following function:

Public Function CurrentUserCanOpenPage(ByVal TheURL As String) As Boolean
'determine if the current user can open the page with the given URL
End Function

TIA,

Corno
 
J

Joe Kaplan \(MVP - ADSI\)

It depends a great deal on how the authorization is being done. Are you
using Windows ACLs or a custom role-based mechanism or something else?

Joe K.
 
R

Rajesh Kumar

If u r using urs own authentication then the given function is correct but
in that case you must have stored the access right information regarding
each page in the database or somewhere else.
 
C

Corno

Yes, I'm using Windows ACL. The webserver runs in an active directory and in
the web.config of the pages I've configured access rights.
How would I do it in that case?

TIA,

Corno
 
J

Joe Kaplan \(MVP - ADSI\)

The only way I know to do this correctly is to use the AccessCheck Windows
API function via pinvoke. It is a bit of a pain to set it up, but it should
give you the most reliable results.

The other thing you might do is simply impersonate the user and try to
access the file via a System.IO class, catching the exception if it occurs.
That is less elegant and possibly slower, but probably a lot easier to
implement.

Joe K.
 

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
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top