Responce.AppendHeader有什么用(字符串名称,字符串值) [英] What is the use of Responce.AppendHeader(string name,string value )
本文介绍了Responce.AppendHeader有什么用(字符串名称,字符串值)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨朋友
i正在处理一些项目,我在页面加载中得到了这个方法(Responce.AppendHeader(字符串名称,字符串值))
谢谢你提前
Hi friends
i am working on some project,there i got this methdod( Responce.AppendHeader(string name,string value )) in the page load
Thank u in advance
推荐答案
如果使用AppendHeader方法发送特定于缓存的标头,同时使用缓存对象模型(Cache)来设置缓存策略,HTTP当使用缓存对象模型时,可能会删除与缓存(Cache-Control,Expires,Last-Modified,Pragma和Vary)相关的响应头。此行为使ASP.NET能够维护最严格的设置。例如,考虑包含用户控件的页面。如果这些控件具有冲突的缓存策略,则将使用限制性最强的缓存策略。如果一个用户控件设置标题Cache-Control:Public,而另一个用户控件通过调用SetCacheability设置限制性更强的标题Cache-Control:Private,那么Cache-Control:Private标题将随之发送回复。
参考
http://msdn.microsoft.com/en-us/library/system.web.httpresponse.appendheader(v = vs.110)的.aspx [ ^ ]
If you use the AppendHeader method to send cache-specific headers and at the same time use the cache object model (Cache) to set cache policy, HTTP response headers that pertain to caching (Cache-Control, Expires, Last-Modified, Pragma, and Vary) might be deleted when the cache object model is used. This behavior enables ASP.NET to maintain the most restrictive settings. For example, consider a page that includes user controls. If those controls have conflicting cache policies, the most restrictive cache policy will be used. If one user control sets the header "Cache-Control: Public" and another user control sets the more restrictive header "Cache-Control: Private" via calls to SetCacheability, then the "Cache-Control: Private" header will be sent with the response.
Ref
http://msdn.microsoft.com/en-us/library/system.web.httpresponse.appendheader(v=vs.110).aspx[^]
我想到的第一件事:如果你不知道为什么附加标题,你可能不需要它为你的项目(您没有费心去讨论):-)。
我无法理解为什么如此清晰的原始MSDN文档需要一些额外的解释: http://msdn.microsoft.com/en-us/library/system.web.httpresponse.appendheader%28v=vs.110%29.aspx [ ^ ]。
这个问题的唯一原因可能是:您不知道为什么标题用于所有。这意味着您应该了解HTTP的工作原理,特别是这些标题的作用:
http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol [ ^ ],
http://en.wikipedia.org/wiki/List_of_HTTP_header_fields [ ^ ]。
-SA
First thing which comes to my mind: if you don't know why appending a header, you probably don't need it for your project (which you did not bother to talk about) :-).
I cannot understand why so clear original MSDN documentation needs some extra explanations: http://msdn.microsoft.com/en-us/library/system.web.httpresponse.appendheader%28v=vs.110%29.aspx[^].
Probably the only reason of such question could be this: you have no idea why the headers are used at all. It would mean that you should learn how HTTP works, and, in particular, the role of those headers:
http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol[^],
http://en.wikipedia.org/wiki/List_of_HTTP_header_fields[^].
—SA
这篇关于Responce.AppendHeader有什么用(字符串名称,字符串值)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文