如何通过单击“登录”按钮区分代理和用户的登录? [英] How Can I Differentiate Login Of Agent And User By Clicking 'Login' Button?

查看:52
本文介绍了如何通过单击“登录”按钮区分代理和用户的登录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为不同的登录用户(如代理和用户)创建带有登录按钮的索引页面。

所以请说明如何区分它们?

I'm creating Index Page with the Login button for different login users like Agent and user.
so give an idea that how could I differentiate them?

推荐答案

为他们分配不同的角色:演练:管理具有角色的网站用户 [ ^ ]
Assign them with different roles: Walkthrough: Managing Web Site Users with Roles[^]


如果这是Web表单,则为每个按钮提供自己的单击事件,您将知道被触发的事件单击了哪个。如果mvc然后查看Request.Form [XYZ],其中XYZ是相应按钮的名称,而非空的那个是被点击的那个



If this is web forms then give each button its own click event and you'll know which was clicked by the event that is fired. If mvc then look at the Request.Form["XYZ"] where XYZ is the name of the respective buttons, and the one that isn't empty is the one that was clicked

<input type="submit" name="LoginAgent" value="Login"/>
<input type="submit" name="LoginUser" value="Login"/>

// in your code

if (!string.IsNullorWhiteSpace(Request.Form["LoginAgent"]))
{
    // agent login clicked
}





如果您不想使用点击事件,也可以将上述技术用于webforms。



编辑:对不起,上面是c#而不是vb.net但是你得到了要点,转换它很容易



You can also use the above technique with webforms if you don't want to use click events.

sorry, above is in c# and not vb.net but you get the gist, it's easy to convert it


谢谢F-ES Sitecore和Peter Leow
thank you F-ES Sitecore and Peter Leow


这篇关于如何通过单击“登录”按钮区分代理和用户的登录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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