我想在 asp.net 中扩展 IPrincipal 以允许我获得我将定义的用户类型。我想在 Controller 中实现这一点
string type = User.UserType
然后在我的扩展方法中我将有一个类似的方法
public string UserType()
{
// do some database access
return userType
}
我该怎么做?是否可以? 谢谢!
最佳答案
你可以做一个扩展方法:
public static string UserType(this IPrincipal principal) {
// do some database access
return something;
}
关于c# - asp.net 扩展 IPrincipal,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3214520/