NetBlog主题

开源(LazyCaptcha).net core 验证码
.Net Core

开源(LazyCaptcha).net core 验证码

201

开源地址 https://gitee.com/pojianbing/lazy-captcha工作原理:1、客户端向服务端获取验证码图片2、服务端 返回 验证码的标识ID和图片的base64图片的字符串3、客户端将服务端返回的 验证码ID和图片上内容 发送给服务端4、服务端验证 客户端发送的验证码是否正确本文来自 www.…

.net Core API接口 JWT Token创建与认证(源码实例)
.Net Core

.net Core API接口 JWT Token创建与认证(源码实例)

297

视频讲解地址 https://www.bilibili.com/video/BV1XN4y1x758/1、添加服务(Nuget 安装 Microsoft.AspNetCore.Authentication.JwtBearer)//添加JWT身份验证服务builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) .AddJwtBearer(options =…

C#, .Net添加log4net日志功能
.Net Core

C#, .Net添加log4net日志功能

6036

相关的视频教程 https://www.bilibili.com/video/BV1664y1C7ko/ (如果不会请看我录制的视频教程)log4net.config配置文件?xml version="1.0" encoding="utf-8"?configuration configSections section name="log4net" type="log4net.Config.Log4NetConfig…

.net core 允许跨域
.Net Core

.net core 允许跨域

547

允许所有跨域,在 startup.cs 中的 ConfigureServices 添加如下代码services.AddCors(options ={ options.AddPolicy("AllowAllCors", builder = builder.AllowAnyOrigin() .AllowAnyHeader() .AllowAnyMethod());});在 startup.cs 中…

C# .Net Nginx组合获取客户端真实IP
.Net Core

C# .Net Nginx组合获取客户端真实IP

531

nginx.conf配置文件部分信息server { listen 80; server_name www.luofenming.com; location / { proxy_pass http://localhost:8711; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_set_header …

.Net core API接收图片文件并保存
.Net Core

.Net core API接收图片文件并保存

2714

以下是核心代码[HttpPost]public async Taskstring Image(IFormFile file){ ResultModel result = new ResultModel(); if (!new[] { "image/jpeg", "image/png" }.Contains(file.ContentType)) { result.code = 2; result.msg = "图片仅支持j…

.net 5.0 API权限控制和数据防篡改(附源码实例)
.Net Core

.net 5.0 API权限控制和数据防篡改(附源码实例)

1756

1、客户端登入获取当前登入帐号信息1.1、客户端发送帐号和密码到他们端假设 用户ID:lqwvje 密码:1234561.2、服务端响应客户端服务端对客户端发送的帐号、密码、权限校验,如果都通过即返回用户信息( 用户ID:lqwvje 密码:123456 密钥:e10adc3949ba59abbe56e057f20f883e 权…