aps.net cored 新概念
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 新概念的更多相关文章
- [新概念英语II 笔记] Lesson 3: Please Send Me a Card
发现身边很多程序员都能看懂英文技术文章的60%-80%内容,但大家都有一个毛病,就是不会说,不会写作,在逛英文技术社区的时候,想发表点什么评论,总担心自己写的话有错误.究其原因, 我觉得主要原因是因为 ...
- 新概念英语(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 ...
- 新概念英语(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, ...
- 新概念英语(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 ...
- 新概念英语(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 ...
- 新概念英语(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 ...
- 新概念英语(1-35)Our village
新概念英语(1-35)Our village Are the children coming out of the park or going into it ? This is a photogra ...
- 新概念英语(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 ...
- 新概念英语(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 ...
随机推荐
- EF 增删改
一.新增 UserInfo user = new UserInfo() { UserName = "jamsebing", UserPass = " }; db.User ...
- win7提示“User Profile Service服务未能登录”
注:本文由Colin撰写,版权所有!转载请注明原文地址,谢谢合作! 最近,有个同事打电话告诉我说他的用户名无法登陆到系统,提示“User Profile Service服务未能登录,无法加载用户配置文 ...
- FMDB线程安全
//打开数据库 如果没有就创建 NSString *path = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUse ...
- jQuery如何判断元素是否是隐藏的?
jQuery函数简介: is(expr) 用一个表达式来检查当前选择的元素集合,如果其中至少有一个元素符合这个给定的表达式就返回true. 如果没有元素符合,或者表达式无效,都返回'false'. 注 ...
- C/C++ 结构体内存对齐
内存对齐是指的是编译器在编译的时候总是会将结构体的元素的地址放在一些合适的位置使得CPU访问这些数据的效率变得更高.首先来看下面这个例子: struct A{ char a; char b; int ...
- curl发送get和post请求
function getAction($url='') { // curl 请求一共分四步,初始化,设置属性,执行并获取结果,释放句柄 // 一.初始化 $curl = curl_init(); // ...
- git 教程(13)--创建与合并分支
在版本回退里,你已经知道,每次提交,Git都把它们串成一条时间线,这条时间线就是一个分支.截止到目前,只有一条时间线,在Git里,这个分支叫主分支,即master分支.HEAD严格来说不是指向提交,而 ...
- cookie 和session 区别
会话技术: Cookie:客户端技术.将数据保存在客户端浏览器上.Cookie是有大小和个数的限制. Session:服务器端技术.将数据保存在服务器端.Session没有大小和个数限制.Sessio ...
- 【XLL 框架库函数】 TempActiveRef/TempActiveRef12
[XLL 框架库函数] TempActiveRef/TempActiveRef12 创建一个包含所有激活工作表引用区域 XLOPER/XLOPER12 LPXLOPER TempActiveRef(B ...
- Mybatis #和$的区别
1.#将传入的数据当成一个字符串,会自动加上双引号.如 oder by #{id} ,那么解析后为oder by “id” 2.$对传入的数据不进行操作,直接显示原值.如oder by ${i ...