Change default ASP MVC Request Header to add your own values

后端 未结 3 2058
太阳男子
太阳男子 2021-01-12 01:47

Im trying to change all my ASP MVC HTTP response headers to have another value by default for implementing Pingback auto-discovery in my blog application.

The defaul

3条回答
  •  既然无缘
    2021-01-12 02:02

    I know this post is old...but wanted to point out that while OnResultExecuting is the proper method to be doing this from, the original post shows that he was trying to add headers to the request. One does not simply add headers to a request and expect them to show up in the response. ;-)

    Also, the proper way to add headers to a response...that also works in Cassini...is to use the following:

    filterContext.HttpContext.Response.AddHeader("X-My-Request-Header", "works in cassini");
    

提交回复
热议问题