摘要: 一、普通路由 需要启用属性路由 App_Start/RouteConfig.cs routes.MapMvcAttributeRoutes();//启用路由属性,启用后可在控制器上设置路由 1、修改Controller路由 [RoutePrefix("news")] //修改Controller路由 阅读全文
posted @ 2022-10-25 10:47 WebApi 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 1、在 Startup.cs 的函数 ConfigureServices 添加 services.AddControllers(); public void ConfigureServices(IServiceCollection services) { services.AddRazorPages 阅读全文
posted @ 2022-10-12 18:22 WebApi 阅读(250) 评论(0) 推荐(0) 编辑
摘要: js修改网址URL参数后实现刷新和不刷新 //获取URL参数 function GetQueryString(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); var r = window.location.search. 阅读全文
posted @ 2022-09-23 09:12 WebApi 阅读(1305) 评论(0) 推荐(0) 编辑
摘要: 一、查看.Net Framework版本 1、打开cmd 2、输入代码 reg query "HKLM\Software\Microsoft\NET Framework Setup\NDP" /s /v version | findstr /i version | sort /+26 /r 二、查看 阅读全文
posted @ 2022-09-20 09:25 WebApi 阅读(2193) 评论(0) 推荐(0) 编辑
摘要: 安装 .Net Framework 4.6-4.8时,遇到错误提示 一、错误1: 提示:已处理证书链,但是在不受信任提供程序信任的根证书中终止。 .net4.8下载地址https://support.microsoft.com/zh-cn/topic/%E9%80%82%E7%94%A8%E4%BA 阅读全文
posted @ 2022-04-10 10:23 WebApi 阅读(3860) 评论(1) 推荐(1) 编辑
摘要: 不但修改滚动条样式,还能修复滚动条闪一下后不显示问题 css1 ::-webkit-scrollbar { width: 15px; height: 15px } ::-webkit-scrollbar-track { background-color: #f5f5f5;/*transparent* 阅读全文
posted @ 2022-03-03 16:16 WebApi 阅读(2676) 评论(0) 推荐(0) 编辑
摘要: NuGet: Install-Package System.Linq.Dynamic //NULL类型判断 var query = dbContext.sys_user.Where("userid!=null").OrderBy("id desc"); //整形的查询 var query = dbC 阅读全文
posted @ 2022-02-19 13:51 WebApi 阅读(325) 评论(0) 推荐(0) 编辑
摘要: 多个参数无需自定义类,get 就1种写法,post共2种写法 html <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title></title> </head> <body> <div> <form id="form_add"> < 阅读全文
posted @ 2021-12-18 16:23 WebApi 阅读(683) 评论(0) 推荐(0) 编辑
摘要: asp.net生成微信小程序二维码 using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.IO; using System.Net; using Newton 阅读全文
posted @ 2021-11-25 14:25 WebApi 阅读(517) 评论(0) 推荐(0) 编辑
摘要: 按顺序执行dos命令 1》diskpart 2》list disk 3》select disk 1 4》attributes disk clear readonly 5》online disk 阅读全文
posted @ 2021-11-10 16:45 WebApi 阅读(85) 评论(0) 推荐(0) 编辑
摘要: JSON Web Token(缩写 JWT)是目前最流行的跨域认证解决方案,本文介绍它的用法。 jwt原理请看这里 1、nuget中安装jwt 2、新建3个实体 using System; using System.Collections.Generic; using System.Linq; us 阅读全文
posted @ 2021-10-27 17:35 WebApi 阅读(1246) 评论(0) 推荐(0) 编辑
摘要: 中国各省+城市经纬度 1 export default { 2 阿克苏地区: [80.260604, 41.168779], 3 和田地区: [79.922211, 37.114157], 4 上海: [121.480237, 31.236305], 5 东莞: [113.758231, 23.02 阅读全文
posted @ 2021-10-15 11:59 WebApi 阅读(2106) 评论(2) 推荐(0) 编辑
摘要: 一、MVC提交 视图 @using (Html.BeginForm()) { @Html.AntiForgeryToken() <p> <strong><em>*</em>姓名:</strong><input type="text" id="name" name="name" /> </p> <p> 阅读全文
posted @ 2021-10-09 09:48 WebApi 阅读(213) 评论(0) 推荐(0) 编辑
摘要: ExpandoObject作为ViewModel给view传值 Action public ActionResult Index(string id) { dynamic d = new ExpandoObject(); d.id = id; d.name = "张三"; return View(d 阅读全文
posted @ 2021-09-27 13:57 WebApi 阅读(340) 评论(0) 推荐(0) 编辑
摘要: 1.在controller里获取路由参数: var controller = RouteData.Values["controller"];//action,id或其他路由参数同理 这种方式很常用,还有一种方式就是,直接在action上定义参数,通过模型绑定的方式获取: public ActionR 阅读全文
posted @ 2021-09-23 13:35 WebApi 阅读(252) 评论(0) 推荐(0) 编辑
CopyRight © 博客园 WebAPI