Show X-Frame-Options: header in asp.net development server

1.6k views Asked by At

When I run my application in Windows Azure I can see the X-Frame-Options in the header. When I run it in the asp.net development server (on localhost), I am not able to view that header.

How can I make the application include the X-Frame-Options header while it is running in the asp.net development server (on localhost)?

Azure output:
HTTP/1.1 200 OK
Cache-Control: private
Content-Type: text/html; charset=utf-8
Content-Encoding: gzip
Vary: Accept-Encoding
Server: Microsoft-IIS/8.0
X-AspNet-Version: 4.0.30319
**X-Frame-Options: SAMEORIGIN**
X-Powered-By: ASP.NET
Date: Mon, 01 Dec 2014 08:37:30 GMT
Content-Length: 2039

Local dev server output:

HTTP/1.1 200 OK
Server: ASP.NET Development Server/11.0.0.0
Date: Mon, 01 Dec 2014 09:28:08 GMT
X-AspNet-Version: 4.0.30319
Cache-Control: private
Content-Type: text/html; charset=utf-8
Content-Length: 622
Connection: Close
1

There are 1 answers

3
Richard On BEST ANSWER

To set headers in IIS you need the IIS manager: in the tree select your web application and the open the "HTTP Response Headers" control.

Or, you could, add the header to the Response.Headers collection in your code.