NetBlog主题

C#, .net H5跳转到微信小程序
.Net Core

C#, .net H5跳转到微信小程序

330

获取加密scheme码 的C#代码using Newtonsoft.Json;using Newtonsoft.Json.Linq;using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace ConsoleApp1{ public static class WChatUtil { …

.net Core Swagger接口UI界面添加注释和修改版本号
.Net Core

.net Core Swagger接口UI界面添加注释和修改版本号

444

效果如下图操作如下.net 5在Startup.cs里面添加代码,.net 6以上在Program.cs添加代码。public void ConfigureServices(IServiceCollection services){ services.AddControllers(); services.AddSwaggerGen(c = { //文档版本号和标题修改 c.Swag…

C#验证码生成和使用,开源(LazyCaptcha).net core 验证码
.Net Core

C#验证码生成和使用,开源(LazyCaptcha).net core 验证码

983

工作原理:1、客户端带一个标识ID向服务端获取验证码图片2、服务端 返回 验证码的图片3、客户端将服务端返回的 验证码图片的字符串和标识ID 发送给服务端4、服务端验证 客户端发送的验证码是否正确效果图视频教程,点击进入B站可以看高清视频开源地址 https://gitee.com/pojia…

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

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

1818

视频讲解地址 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日志功能

7494

log4net.config配置文件?xml version="1.0" encoding="utf-8"?configuration configSections section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net-net-1.0"/ /configSections log4netappende…

.net core 允许跨域
.Net Core

.net core 允许跨域

971

允许所有跨域,在 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

1048

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接收图片文件并保存

3557

以下是核心代码[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…