更新时间:2023-12-04 12:05:10
为他们分配不同的角色:演练:管理具有角色的网站用户 [ ^ ]
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