重定向管理员管理页面和用户到用户的页面

编程入门 行业动态 更新时间:2024-10-26 14:33:38
本文介绍了重定向管理员管理页面和用户到用户的页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我遇到过一些在这里的问题。当用户输入自己的ID,它会显示在主页和用户,但是当管理员输入自己的ID,就会进入用户的主页,我必须点击顶部的超链接管理的网站,它会自动注销,一旦我进入回管理员passwrd,然后只重定向到管理员page.how使它像曾经的用户输入他们的passwrd重定向到用户页面,一旦进入管理员在登录管理员密码重定向到管理员?我在这里3角色这是管理员,工作人员和user.Hereby我会为你提供我的aspx code,也是我的VB code这是运行program.please背后做辅助me.thanks

i'm having some problem over here. When user enter their id,it will show up the main page and its for user but when admin enter their id,it will enter the user's main page and i have to click admin site on the top hyperlink and it automatically logout and once i enter back admin passwrd and then only it redirect to admin page.how to make it like once user enter their passwrd it redirect to user page and once admin enter admin password in the login it redirect to admin ?I have 3 roles over here which are admin,staff and user.Hereby i'll provide you my aspx code and also my vb code which is running behind the program.please do assist me.thanks

ASPX

<asp:Login ID="Login1" runat="server" BackColor="#009933" BorderColor="Red" BorderPadding="4" BorderStyle="Ridge" BorderWidth="1px" Font-Names="Verdana" Font-Size="0.8em" ForeColor="Red" DestinationPageUrl="~/MainPage.aspx" style="text-align: center" Height="171px" Width="266px" VisibleWhenLoggedIn="True" TextLayout="TextOnTop"> <TextBoxStyle Font-Size="0.8em" /> <LoginButtonStyle BackColor="#FFFBFF" BorderColor="#CCCCCC" BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="0.8em" ForeColor="#284775" /> <InstructionTextStyle Font-Italic="True" ForeColor="Black" /> <TitleTextStyle BackColor="#5D7B9D" Font-Bold="True" Font-Size="0.9em" ForeColor="White" /> </asp:Login>

VB

Partial Class Login Inherits System.Web.UI.Page End Class

的的web.config 的对于工作人员文件夹

<?xml version="1.0" encoding="utf-8"?> <configuration> <system.web> <authorization> <allow roles="staff" /> <deny users="" /> </authorization> </system.web> </configuration>

的的web.config 的对于管理文件夹

<?xml version="1.0" encoding="utf-8"?> <configuration> <system.web> <authorization> <allow roles="adminstrator" /> <deny users="" /> </authorization> </system.web> </configuration>

的的web.config 的 - 根

<configuration> <appSettings/> <connectionStrings> <add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/> <add name="ASPNETDBConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\Se7en\Desktop\Personal\VIVA\1\App_‌​Data\ASPNETDB.MDF;Integrated Security=True;Connect Timeout=30;User Instance=True" providerName="System.Data.SqlClient"/> </connectionStrings>

推荐答案

刚刚看到您的重新编辑的问题...什么是你的导航的样子? 控制的你用什么?什么样的的的MembershipProvider 的(如果有的话),你呢?

Just saw your re-edited question... What is your navigation like? What controls do you use? what kind of MembershipProvider (if any) do you use?

您仍可以尝试使用一个TreeView或菜单控件(绑定到一个站点地图文件)。使用这些控件,您可以使用 securityTrimming (见 MSDN 了解详细信息)。

You may still try to use a treeView or a menu control (bound to a sitemap file). Using these controls allows you to make use of securityTrimming (see msdn for details).

的例如(从MSDN):的

<system.web> <!-- …other configuration settings --> <siteMap defaultProvider="XmlSiteMapProvider" enabled="true"> <providers> <add name="XmlSiteMapProvider" description="Default SiteMap provider." type="System.Web.XmlSiteMapProvider " siteMapFile="Web.sitemap" securityTrimmingEnabled="true" /> </providers> </siteMap> </system.web>

此属性将改变出现在您的导航控件链接的可见性。例如用户与角色管理 - 只看到他们被允许浏览到这些链接

This attribute will change the visibility of links appearing in your navigation controls. For example users with a role admin - will only see those links they are allowed to navigate to.

能否请您告诉我们您的导航控件?THX提前

Could you please show us your navigation controls? thx in advance

  • 控制(登录,LoginStatus,...)
  • 了解角色管理(如何...的MembershipProvider,角色,ASO)
  • Controls (Login, LoginStatus, ...)
  • Understanding Role Management (how to ... membershipProvider, roles, aso)

更多推荐

重定向管理员管理页面和用户到用户的页面

本文发布于:2023-10-31 18:32:26,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1546922.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:页面   用户   重定向   管理员

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!