how authorization asp(mvc) project from controller?

前端 未结 2 548
半阙折子戏
半阙折子戏 2021-01-29 02:49

I\'m new in asp and I created a login page for my web project but and I set authentication but I can not set authorization for my project! I saw many links like this Authenticat

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-29 03:43

    You need to fully understand ASP.NET 5 Identity model (Check here and here). Then you should implement that with any changes suits to your project. One of the most important things about ASP.NET 5 Identity is its simplicity and flexibility to use with different user types and accessibility with just using annotations for methods. If you have previous experience with SQL Membership, check here to find out how to Migrating from SQL Membership to ASP.NET Identity. Or if you have previous experience with ASP.NET Membership, check here to find out how to Migrate from ASP.NET Membership to ASP.NET Identity. About your question on how say: "welcome PERSON NAME" ?, after implementation ASP.NET 5 Identity, you just need to have

    System.Web.HttpContext.Current.User.Identity.Name

    in where ever you need!.

提交回复
热议问题