角色认证? [英] Role based authentication?

查看:70
本文介绍了角色认证?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个电子商务网站。

有两种类型的用户名

1:-Admin Page

2: - 用户登录页面

现在我有一个问题

当我使用用户帐户登录并提供管理页面链接

用户可以轻松访问管理页面

当用户编写管理页面链接然后页面进入其主页时,我该如何解决这个问题



我尝试过:



基于角色的用户身份验证或amdin

am create a e-commerce website.
there are two type of user roll
1:-Admin Page
2:-User Login Pages
now I have a problem
when I login with user account and give admin pages link
user can access easily admin pages
how can I fixed this problem when user write admin page link then page going on its home page

What I have tried:

role based authentication for user or amdin

推荐答案

尝试在文件夹中创建网站Admins,只允许在web.config中访问角色admin。



Try create a sites in folder of "Admins", allows only roles admin access in web.config.

<location path="Admins">
        <system.web>
            <authorization>
                <allow roles="Admin" />
                <deny users="*" />
            </authorization>
        </system.web>
    </location>


它会跳回主页,因为不允许授权。



有你曾经使用过
It jump back to home page because the authorization is not allowed.

Have you ever using
Microsoft.AspNet.Providers

okay , you know how to use ASP.NET Web Sites Administration Tool, right?

set a "Admins" roles right there, and assign that user to Admins roles.







then跟着我在最顶层发布的信息一样。



然后在登录视图中,在编辑项目中创建一个值Admins并在角色组中切换,

最后添加超链接以带你到那些页面。




?

then followed the same as i show you on top post.

then in login view, create a value "Admins" in "Edit Item" and switch it in rolegroup,
last add hyperlink to bring you to that pages.

<asp:LoginView ID="LoginView1" runat="server">
<RoleGroups>
	<asp:RoleGroup Roles="Admins">
  		<ContentTemplate>
   			<asp:HyperLink ID="HyperLink1" NavigateUrl='<%# "~/Admins/ManageAdmin.aspx?id=123" %>' runat="server" Target="_blank" />
  		</ContentTemplate>
	</asp:RoleGroup>
</RoleGroups>
</asp:LoginView>


这篇关于角色认证?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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