您好如何重定向到垂直母版页? [英] hi how to redirect to perticular master page ?

查看:111
本文介绍了您好如何重定向到垂直母版页?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好如何重定向到特定页面.如果管理员密码和ID匹配,它应该重定向到管理员母版特定页面;或者如果用户登录密码和ID匹配,它应该重定向到用户母版特定页面. admin只能访问所有页面,而..user只能访问用户页面

hi how to redirect to particular page.if admin password and id matches it should redirect to admin masters particular page or if User login password and id matches it should redirect to User masters particular page.?can any one help..and admin only can access all pages and..user only can access user pages only

推荐答案

因为母版页和内容页在初始化期间合并页处理,在此之前必须分配一个母版页.通常,您在PreInit阶段动态分配母版页,如以下示例所示:
void Page_PreInit(Object sender, EventArgs e)
{
    this.MasterPageFile = "~/NewMaster.master";
}



从这里摘录:
http://msdn.microsoft.com/en-us/library/c8y19k6h.aspx [ ^ ]

因此,您可以在会话变量中设置母版页名称,以使每个页面都知道应将其分配给哪个母版页.

您必须根据用户访问类型更改该会话变量.

希望对您有所帮助.



Extracted from here :
http://msdn.microsoft.com/en-us/library/c8y19k6h.aspx[^]

So you can set a master page name in a session variable to let every page know to which master page they should be assigned.

You have to change that session variable based on user access type.

Hope it helps.


有用的参考位于Microsoft页面
Useful reference is at microsoft page http://www.asp.net/web-forms/tutorials/security/membership/user-based-authorization-cs[^]


您无法浏览母版页.添加内容页面并在Session ["yourKey"]为空时导航
You can not navigate a Master page. Add a content page and navigate when Session["yourKey"] is null


这篇关于您好如何重定向到垂直母版页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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