NET 升级NET7 记录
Get 和Post获取传值
Get
string strNewPassWord = HttpContext.Request.Query["NewPassWord"]; string strOldPassWord = HttpContext.Request.Query["OldPassWord"];
Post
string strNewPassWord = HttpContext.Request.Form["NewPassWord"]; string strOldPassWord = HttpContext.Request.Form["OldPassWord"];
序列化:
ResponseJsonModel reponseJsonModel = new ResponseJsonModel(); reponseJsonModel.CorrectFlag = "错误"; reponseJsonModel.ErrorContent = "获取馆藏信息失败-" + ex.Message; var settings = new JsonSerializerSettings { DateFormatHandling = DateFormatHandling.MicrosoftDateFormat, DateTimeZoneHandling = DateTimeZoneHandling.Utc, Formatting = Formatting.Indented }; string strInfo = JsonConvert.SerializeObject(reponseJsonModel, settings);
反序列化:
var settings = new JsonSerializerSettings { DateFormatHandling = DateFormatHandling.MicrosoftDateFormat, DateTimeZoneHandling = DateTimeZoneHandling.Utc, Formatting = Formatting.Indented }; AdminBLL.AdminInfo admin = JsonConvert.DeserializeObject<AdminBLL.AdminInfo>(strAdminJson, settings);////反序列化