views:

146

answers:

2

Our asp.net web site is currently deployed to an IIS7 server. We are setting some http headers via the config file such as this:

<httpProtocol>
  <customHeaders>
    <remove name="X-UA-Compatible" />
    <add name="X-UA-Compatible" value="IE=EmulateIE7" />
  </customHeaders>
</httpProtocol>

This works great for myself as I host my personal web under IIS. My Co-Worker is pretty bent on continuing to use Cassini for his development experience, which means our custom headers are not being sent. Is there a way to tell cassini to send these headers?

I would rather not have to code up a custom module to add this, and I don't want to add the header on every page in our site.

+1  A: 

Perhaps you could add a pre-compiler directive in the Global.asax so it will only add the header when compiled in DEBUG mode:

protected void Application_BeginRequest(object sender, EventArgs e)
{
#if DEBUG
    HttpContext.Current.Response.AddHeader("X-UA-Compatible", "IE=EmulateIE7");
#endif
}

The production RELEASE compilation would ignore this but continue to add the header via the web.config setting in IIS.

300 baud
+1  A: 

This feature is in the todo for the next release of CassiniDev, amongst others that may be of interest.

Sky Sanders
That looks cool...thanks. IIS Express should also be a much better option than the classic Cassini.
JoshBerke