Tag Helpers

The EnvironmentTagHelper can be used to include different scripts in your views (for example, raw or minified) based on the runtime environment, such as Development, Staring, or Production:

 <environment names="Development">
<script src="~/lib/jquery/dist/jquery.js"></script>
</environment>
<environment names="Staging,Production">
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-2.1.4.min.js"
asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
asp-fallback-test="window.jQuery">
</script>
</environment>

formating

 By default MVC includes a JsonInputFormatter class for handling JSON data, but you can add additional formatters for handling XML and other custom formats.可以添加其它的formatting.例如:

services.AddMvc()
.AddXmlSerializerFormatters();或者
services.AddMvc(options =>
{
options.OutputFormatters.Add(new XmlSerializerOutputFormatter());
});
 

Action可以返回一个对象,Controller actions can return POCOs (Plain Old CLR Objects), in which case ASP.NET MVC will automatically create an ObjectResult for you that wraps the object.

强制格式化返回数据:[Produces] filter

[Produces("application/json")]
public class AuthorsController

在url中定义数据格式:

 [FormatFilter]
public class ProductsController
{
[Route("[controller]/[action]/{id}.{format?}")]
public Product GetById(int id)

Response cache 

The primary HTTP header used for caching is Cache-Control. The HTTP 1.1 specification details many options for this directive. Three common directives are:

public
Indicates that the response may be cached.
private
        此种情况只能保存个人的缓存中,比如浏览器。
Indicates the response is intended for a single user and must not be cached by a shared cache. The response could still be cached in a private cache (for instance, by the user’s browser).
no-cache
Indicates the response must not be used by a cache to satisfy any subsequent request (without successful revalidation with the origin server).

aps.net cored 新概念的更多相关文章

  1. [新概念英语II 笔记] Lesson 3: Please Send Me a Card

    发现身边很多程序员都能看懂英文技术文章的60%-80%内容,但大家都有一个毛病,就是不会说,不会写作,在逛英文技术社区的时候,想发表点什么评论,总担心自己写的话有错误.究其原因, 我觉得主要原因是因为 ...

  2. 新概念英语(1-47)A cup of coffee

    新概念英语(1-47)A cup of coffee How does Ann like her coffee? A:Do you like coffee, Ann? B:Yes, I do. A:D ...

  3. 新概念英语(1-45)The boss's letter

    新概念英语(1-45)The boss's letter Why can't Pamela type the letter? A:Can you come here a minute, please, ...

  4. 新概念英语(1-43)Hurry up!

    新概念英语(1-43)Hurry up! How do you know Sam doesn't make the tea very often? A:Can you make the tea, Sa ...

  5. 新概念英语(1-41)Penny's bag

    新概念英语(1-41)Penny's bag Who is the tin of tobacco for? A:Is that bag heavy, Penny? B:Not very. A:Here ...

  6. 新概念英语(1-39)Don't drop it!

    新概念英语(1-39)Don't drop it! Where does Sam put the vase in the end ? A:What are you going to do with t ...

  7. 新概念英语(1-35)Our village

    新概念英语(1-35)Our village Are the children coming out of the park or going into it ? This is a photogra ...

  8. 新概念英语(1-32)A fine day

    新概念英语(1-33)A fine day Where is the Jones family? It is a fine day today. There are some clouds in th ...

  9. 新概念英语(1-31)Where's Sally?

    新概念英语(1-31)Where's Sally? Is the cat climbing the tree ? A:Where is Sally, Jack ? B:She is in the ga ...

随机推荐

  1. Python调用服务接口

    #! /usr/bin/env python # coding=utf-8 ############################################################## ...

  2. ubuntu 系统使用

    1.ubuntu的鼠标,用起来总是感觉比windows的快一点儿,可以用以下命令来调整为默认的 root@admin-pc:~$ xset m default 2.mysql默认不允许远程连接,可以在 ...

  3. Coursera-Getting and Cleaning Data-Week3-dplyr+tidyr+lubridate的组合拳

    Coursera-Getting and Cleaning Data-Week3 Wednesday, February 04, 2015 好久不写笔记了,年底略忙.. Getting and Cle ...

  4. UI第十节——UISwitch

    - (void)viewDidLoad {    [super viewDidLoad];        // 实例化UISwitch,固定大小    UISwitch *swc = [[UISwit ...

  5. Chrome 用户数据配置文件夹保存路径在哪?(Mac OS X/Windows/Linux)

    在重装系统之前都想要对 Chrome 中的数据进行备份,以能够在重装系统后恢复这些数据.但是除了一些玩 Chrome 很长时间的用户,鲜有人知道 Chrome 的用户数据到底保存在什么地方.如果你也有 ...

  6. zozoui

    http://zozoui.com/tabs/?utm_source=cc_tabs&utm_medium=codecanyon&utm_campaign=Codecanyon+-+T ...

  7. 瀑布流布局——jquery

    首先确定定位,因为.box的宽度是确定的,根据屏幕的宽度来调整.box的列数,所以#content的宽度是随着.box的列数变化而变化的,并且需要保持相对于body居中. 因此需要给#content添 ...

  8. Android手机截屏方法

    <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/> <u ...

  9. PDO和PDOStatement类常用方法

    PDO — PDO 类 PDO::beginTransaction — 启动一个事务 PDO::commit — 提交一个事务 PDO::__construct — 创建一个表示数据库连接的 PDO ...

  10. Servlet 之 GenericServlet

    我们都知道javaweb中servlet的三大组件 servlet filter listener 实现动态资源的  是可以继承  Servlet接口,或者集成GenericServlet .Http ...