开发者

Check if user is allowed to see the web page in asp.net

Depending on user permissions some pages will be available to him, and o开发者_JAVA技巧thers not.

We created the base page that inherits the System.Web.Ui.Page, and all pages inherit this page.

In Page_load event (of our base pages class) we check if user is allowed to view the page.

If not we redirect to another page that says not allowed (Response.Redirect).

Is this a good approach or there is something better?

Note:

Thanks all for suggestions, but ASP.NET Membership is not an option by requirements :(. Sorry.


Check out ASP.NET Membership, read this article on MSDN: Introduction to Membership. You don't want to re-invent the wheel. Membership will let you control locations, files, folders etc on roles / users.

It's a really powerfull mechanism

Here are some usefull links:

  • Understanding Role Management
  • Managing Website Users with Roles


You can use asp.net role provider and the site map provider with security trimming

http://msdn.microsoft.com/en-us/library/ms178428.aspx


You need to implement a Role-based security to your website. Check the following link: http://support.microsoft.com/kb/311495

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜