mvc core2.1 Identity.EntityFramework Core 导航状态栏(六)
之前做的无法 登录退出,和状态,加入主页导航栏
Views ->Shared->_Layout.cshtml
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a asp-area="" asp-controller="Home" asp-action="Index">Home</a></li>
<li><a asp-area="" asp-controller="Home" asp-action="About">About</a></li>
<li><a asp-area="" asp-controller="Home" asp-action="Contact">Contact</a></li>
</ul>
@await Html.PartialAsync("_LoginPartial") //加这句
Views ->Shared->_LoginPartial.cshtml 新建
@using Microsoft.AspNetCore.Identity
@using IdentityMvc.Models @inject SignInManager<ApplicationUser> SignInManager
@inject UserManager<ApplicationUser> UserManager @if (SignInManager.IsSignedIn(User))
{
<form asp-area="" asp-controller="Account" asp-action="Logout" method="post" id="logoutForm" class="navbar-right">
<ul class="nav navbar-nav navbar-right">
<li>
<a asp-area="" asp-controller="Role" asp-action="Index" title="Manage">Hello @UserManager.GetUserName(User)!</a>
</li>
<li>
<button type="submit" class="btn btn-link navbar-btn navbar-link">Log out</button>
</li>
</ul>
</form>
}
else
{
<ul class="nav navbar-nav navbar-right">
<li><a asp-area="" asp-controller="Account" asp-action="Register">Register</a></li>
<li><a asp-area="" asp-controller="Account" asp-action="Login">Log in</a></li>
</ul>
}
mvc core2.1 Identity.EntityFramework Core 导航状态栏(六)的更多相关文章
- mvc core2.1 Identity.EntityFramework Core 配置 (一)
https://docs.microsoft.com/zh-cn/aspnet/core/security/authentication/customize_identity_model?view=a ...
- mvc core2.1 Identity.EntityFramework Core ROle和用户绑定查看 (八)完成
添加角色属性查看 Views ->Shared->_Layout.cshtml <div class="navbar-collapse collapse"> ...
- mvc core2.1 Identity.EntityFramework Core 用户Claims查看(七)
添加角色属性查看 Views ->Shared->_Layout.cshtml <div class="navbar-collapse collapse"> ...
- mvc core2.1 Identity.EntityFramework Core 实例配置 (四)
https://docs.microsoft.com/zh-cn/aspnet/core/security/authentication/customize_identity_model?view=a ...
- mvc core2.1 Identity.EntityFramework Core 注册 (二)
Startup.cs-> Configure app.UseAuthentication(); //启动验证 Controllers->AccountController.cs 新建 us ...
- mvc core2.1 Identity.EntityFramework Core 用户列表预览 删除 修改 (五)
用户列表预览 Controllers->AccountController.cs [HttpGet] public IActionResult Index() { return View(_us ...
- mvc core2.1 Identity.EntityFramework Core 登录 (三)
Controllers->AccountController.cs 新建 [HttpGet] [AllowAnonymous] public async Task<IActionResul ...
- webapi core2.1 Identity.EntityFramework Core进行配置和操作数据 (一)没什么用
https://docs.microsoft.com/en-us/aspnet/core/security/authentication/identity?view=aspnetcore-2.1&am ...
- webapi core2.1 IdentityServer4.EntityFramework Core进行配置和操作数据
https://identityserver4.readthedocs.io/en/release/quickstarts/8_entity_framework.html 此连接的实践 vscode ...
随机推荐
- mac navicate破解版汉化
https://pan.baidu.com/s/1dRoalG8lZ-AMGmZrj8OhpQ 提取密码:e8ad 安装完navicate之后解压zh-Hans.zip 点击Resources文件夹 ...
- 【HTTP】boundary 中一个 = 导致HTTP上传文件失败
(1)#define ABOUNDARY "----=_Resume_002_0CE7_01D1C649.298A8070" (2)#define ABOUNDARY " ...
- 【Eclipse使用】在eclipse里添加源文件和Api的方法
一.源代码添加 你的JDK安装目录下%Java_home%/src.zip文件就是源码,解压缩找到对应包下面的类即可. 如果是Eclipse开发,ctr+鼠标左击,出现不了源码的话,在弹出的视图中点击 ...
- js中 offset /client /scroll总结
offset家族(只能读取,不能操作): offsetLeft:元素的边框的外边缘距离与已定位的父容器(offsetparent)的左边距离(就是子元素左边框到父元素左边框的距离). offsetTo ...
- (C/C++学习笔记) 五. 常变量(只读变量)和宏
五. 常变量(只读变量)和宏 ● 常变量 常变量 #include <iostream.h> //预处理文件 int main() { const d ...
- Cracking The Coding Interview 3.5
//Implement a MyQueue class which implements a queue using two stacks. #include <iostream> #in ...
- hdu 5228 OO’s Sequence(单独取数算贡献)
Problem Description OO has got a array A of size n ,defined a function f(l,r) represent the number o ...
- 解决You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order (order_name, customer)
在学习hibernate一对多映射关系时,根据视频学习的时候,例子是顾客和订单的问题,一个顾客有多个订单.按照视频中的敲代码出现了You have an error in your SQL synta ...
- ubantu创建python虚拟环境
安装虚拟环境的命令如下: sudo pip install virtualenv sudo pip install virtualenvwrapper 创建虚拟环境的命令如下: mkvirtualen ...
- Java学习笔记28(IO字节流)
IO定义: 写:Output操作:将内存上的数据持久化 到设备上,这个动作称为输出: 读:Input操作:把硬盘上的东西读取到内存,这个动作称为输入: 这两种操作称为IO流 ...