重定向管理员管理页面和用户到用户的页面 [英] Redirecting admin to admin page and user to user's page

查看:312
本文介绍了重定向管理员管理页面和用户到用户的页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到过一些在这里的问题。当用户输入自己的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

  • Controls (Login, LoginStatus, ...)
  • Understanding Role Management (how to ... membershipProvider, roles, aso)

这篇关于重定向管理员管理页面和用户到用户的页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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