开发者

User Specific Aceess to the menu in asp.net with C#

ASP.NET with C#

I want to create user through my registration page.

While creating the user i should be able to provide which menu or links the user should be able to access.

According to the registration, when the user will login then it should get the menu which are given to him.

I am using my own authentication (means using database username & password for authenticating)

开发者_如何学编程

Please suggest any thing .....

Thanks.....


Here is my opinion:

Use a table in db like

ID      Text         URL          ParentID      CSS_CLASS     
-----------------------------------------------------------
1       Home        ""              NULL         main
2       Sales       ""              1            submenu

another table for user menu permission

UserID    MenuID       IsAccessible
------------------------------------------
admin        1            Yes
admin        2            No   

Solution 1: use ASP.net repater control and in item template section use <li> html and put a hyperlink control inside li. Then bind repeater with your desire data. You may need a nested repater for the sub menu.

Solution 2: Write your menu in Html with just like static and give a unique id for each. When loading page, read the user permission from database and you may store result in session, so that you dont need to knock further on db. After loading data, set visibility to false for users who don't have permission.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜