Click here to Skip to main content
15,891,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I want to check the url accessible for the logged in user.

In Detail: I am creating a web part for custom menu with security trimming. Menu Items are populating from a custom list. I want to fetch each item from the list, Check its url (whether it is accessible for the current user), if yes add this row to a new datatable and at last bind this datatable to my controller(datalist).

Eg.
C#
foreach (ListItem item in listitemCollection)
{
    string url = item["pageurl"]

    if (Url is accessable) //<<==Need a code for this
    {
        Add url to a datatable
    }    
}


I don't know whether this approach is right. If you have any other idea to achieve this please share.
Posted
Updated 25-Apr-12 1:03am
v2

1 solution

Try Storing the URL in database and Create a Authorization table or group and add all the access permissions to the URLs in the table.

In code see if the user belongs to a group which has authorization to the URL if yes then perform the code if no do not add.



Tables

URLs

ID URL_NAME

Groups

ID GROUP_NAME GROUP_DESCRIPTION

URLGROUPMAPPING TABLE


ID GROUPID URLID HASACCESS


If for a particular grp has access is true then allow the user to access it if not just drop it


In your users table you may need to have an additional column BelongsToGrp
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900