如何在Web表单中设置权限. [英] How to set Privileges in webforms.

查看:68
本文介绍了如何在Web表单中设置权限.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我有一些网页.我需要赋予读取,编辑,删除权限(即).由于我是DotNet的新手,因此如何编写权限.

在此先感谢您.

Hi All,
I hav some webpages . I need to give privileges (ie) read, edit, delete. How to write the permissions since i am new to the DotNet.

Thanks in advance.

推荐答案

如果您没有任何用户和角色,请首先使用网站管理工具.

您需要一个角色"Editor"的用户才能将此代码动态地将编辑按钮加载到名为"PanelWithOptionButtons"的面板中.

您需要在页面上添加一个名为PanelWithOptionButtons的面板,以使此代码正常工作.



然后,您可以使用此...
Firstly use the website admin tool if you don''t have any users and roles.

You will need a user which is role "Editor" for this code to dynamically load a edit button to a panel called "PanelWithOptionButtons"

You need to add a panel to the page called PanelWithOptionButtons to make this code work.



You could then use this...
 protected void Page_Load(object sender, EventArgs e)
        {
            if (User.IsInRole("Editor"))
            {
                Button aNewEditButton = new Button();
                aNewEditButton.Text = "Edit";
                PanelWithOptionButtons.Controls.Add(aNewEditButton);
                aNewEditButton.Click += new EventHandler(aNewEditButton_Click);
            }

        }

        void aNewEditButton_Click(object sender, EventArgs e)
        {
// this is a dynamic event handler for the new edit button write your code here
            throw new NotImplementedException();
        }


需要根据输入的角色维护角色和权限表,以验证其权限(读取,写入或完全访问),然后根据您的要求禁用按钮或导航.

希望以上信息对您有所帮助.

让我们知道:)
Need to maintain Roles and permissions table based on the entered role verify their permission(Read,Write or full Access) and then disable the buttons or navigation based on your requirement.

Hope the above information is helpfull.

Let us Know:)


这篇关于如何在Web表单中设置权限.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆