zoukankan      html  css  js  c++  java
  • .Net core替换.Net Framework记要

    QueryString

    .Net Framework

    Request.QueryString["cartitemids"]
    

    .Net core

    Request.Query["cartitemids"].FirstOrDefault()
    
    response.Output

    .Net Framework

    JsonTextWriter writer = new JsonTextWriter(response.Output)
    

    .Net core

    JsonTextWriter writer = new JsonTextWriter(new StreamWriter(response.Body))
    GetCustomAttributes

    .Net Framework

    filterContext.ActionDescriptor.GetCustomAttributes(typeof(UnAuthorize), false);
    

    .Net core

    ((ControllerActionDescriptor)filterContext.ActionDescriptor).MethodInfo.GetCustomAttributes(typeof(UnAuthorize), false);
    

    response

    .Net Framework

    response.ContentType = "application/ms-excel; charset=gb2312";
    response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312");
    response.Headers.Set("Content-Disposition", string.Format("attachment; filename={0}-{1:yyyy-MM-dd}.xls", _fileName, DateTime.Now));

    .Net core

    response.ContentType = "application/ms-excel; charset=gb2312";
    response.Headers.Add("Content-Disposition", string.Format("attachment; filename={0}-{1:yyyy-MM-dd}.xls", _fileName, DateTime.Now));
    
  • 相关阅读:
    python web 2
    python web1(解析url)
    webstrom 今天突然要激活
    数组排序 记录一下
    浏览器添加随机数去除缓存
    vue-cli 安装报错
    vue 初始化项目报错
    深拷贝和浅拷贝
    css3 属性 clip-path
    js数组去重
  • 原文地址:https://www.cnblogs.com/chengNet/p/13473938.html
Copyright © 2011-2022 走看看