The Light
The Light

Reputation: 27021

How to add a Custom HTTP Header for a page hosted in IIS 7.0?

How to add a Custom HTTP Header for a page hosted in IIS 7.0?

It is possible to add one for a folder but not for a page in IIS 7.0 or I couldn't find out how.

However, in IIS 6.0, you can easily right click on a page and add a custom header via the properties window.

Upvotes: 3

Views: 6417

Answers (1)

Clarice Bouwer
Clarice Bouwer

Reputation: 3811

Add the following meta tag to your page

<meta http-equiv="X-UA-Compatible" content="IE=7" />

Where http-equiv and content are variable: http://weblogs.asp.net/joelvarty/archive/2009/03/23/force-ie7-compatibility-mode-in-ie8-with-iis-settings.aspx

Or programmatically in the code-behind:

//C#
Page.Header.Controls.AddAt(0, new HtmlMeta { HttpEquiv = "X-UA-Compatible", Content = "IE=EmulateIE7" });

'VB.NET
Dim custom As New HtmlMeta
custom.HttpEquiv = "X-UA-Compatible"
custom.Content = "IE=EmulateIE7"
Page.Header.Controls.Add(custom)

Upvotes: 4

Related Questions