dnn:我们如何检查当前登录用户角色以进行重定向 [英] dnn: how can we check the current login user role to redirect

查看:78
本文介绍了dnn:我们如何检查当前登录用户角色以进行重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在登录特定角色用户后重定向页面。但我不知道我可以在代码中进行更改。在dnn模块的login.cs上,我没有使用任何用户名或密码来检查登录用户角色是什么。所以请帮帮我。如果可能的话显示步骤。我是新来的dnn ........

I want to redirect a page after login of a specific role user. but i dont get where i can do the changes in code. on login.cs of dnn module i am not geting any of username or password to check wheather the login user role is what. so please help me. if possible show the steps. i am new to dnn........

推荐答案

if(this.UserId> 0)

{

if(this.UserId>0)
{
DotNetNuke.Entities.Users.UserInfo USERINFO = DotNetNuke.Entities.Users.UserController.GetUserById(PortalId, this.UserId);
                if (!USERINFO.IsInRole("Administrators"))
                {



//做点什么



}}

else

{


//do something

}}
else
{

string loginURL = string.Format("{0}://{1}/Default.aspx?ctl=login",
    Request.Url.Scheme, Request.Url.Host);
Response.Redirect(loginURL);



}


}


这篇关于dnn:我们如何检查当前登录用户角色以进行重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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