简体   繁体   English

ASP.NET MVC Custom User类与System.Security.Principal.iPrinciapl发生冲突

[英]ASP.NET MVC Custom User class is clashing with System.Security.Principal.iPrinciapl

Hey guys I declared my own class User, and when I want to use it, I Include it's namesapce MyProj.Models; 嘿伙计们,我宣布自己的班级用户,当我想使用它时,我包括它的名字Myapj.Models;

But The System.Web.Security.Principal.iPrinciapl (Controller.User) is getting in the way and making me have to write out the whole path to my class if I want to use it. 但System.Web.Security.Principal.iPrinciapl(Controller.User)正在阻碍我,如果我想使用它,我必须写出我班级的整个路径。 IE MyProj.Models.User.DoSomething(). IE MyProj.Models.User.DoSomething()。

How can I get around this? 我怎么能绕过这个? Give mine priority or similar? 给我的优先级或类似?

The way I resolve this is to use a using alias: 解决这个问题的方法是使用using别名:

using mUser = MyProj.name.space.User;

public class MyController : Controller {
    public void foo() {
        var user = new mUser(...);
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Base Controller ASP.NET MVC 3中的此自定义主体效率极低吗? - Is this Custom Principal in Base Controller ASP.NET MVC 3 terribly inefficient? ASP.NET MVC中的自定义安全性方案 - Custom security scenario in ASP.NET MVC 在Asp.Net MVC中验证自定义用户类 - Authenticate custom user class in Asp.Net MVC 如何将安全主体从我的请求传递到asp.net MVC中的线程 - How do I pass security principal from my request into a thread in asp.net MVC 在ASP.net MVC 4中自定义创建用户 - Custom Create User in ASP.net MVC 4 自定义主体显示禁止授权过滤器属性 ASP.Net Core 6 MVC - Custom principal displays Forbidden on Authorize Filter attribute ASP.Net Core 6 MVC asp.net和mvc,安全吗? - asp.net and mvc, security? 如何将自定义用户保存到Asp.NET MVC 5中的用户身份 - How to save custom user to User Identity in Asp.NET MVC 5 ASP.NET用户/会员/会员用户/安全性/主体/配置文件…帮助 - ASP.NET Users/Membership/MembershipUser/Security/Principal/Profile… HELP ASP.NET MVC - 删除默认帐户系统中的用户? - ASP.NET MVC - delete a user in default account system?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM