title: How to replace http header vary Accept-Encoding to vary User-agent in asp.net?
body: <p>I am developing mobile, smartphone, desktop website with same URL dynamic content, i am unable to set vary user-agent. The default value is  Accept-Encoding is coming. How we can replace  vary:Accept-Encoding to vary:User-agent?</p>
  
  <p>I tried all these</p>
  
  <p>1.&lt;%@ OutputCache Duration="180"  VaryByHeader="User-Agent" %></p>
  
  <p>2.HttpContext.Current.Response.AddHeader("Vary", "User-Agent");</p>
  
  <p>3.HttpContext.Current.Items.Add("Vary", "User-Agent");</p>
  
  <p>4.HttpContext.Current.Response.Cache.SetVaryByCustom("User-Agent");</p>
  
  <p>5.HttpContext.Current.Response.Cache.VaryByHeaders.UserAgent = true;</p>
  
  <p>6.HttpContext.Current.Response.Headers.Set("Vary", "User-Agent");</p>
  
  <p>but still coming</p>
  
  <p>Cache-Control:public, max-age=180
  Content-Encoding:gzip
  Content-Length:9741
  Content-Type:text/html; charset=iso-8859-1
  Date:Tue, 23 Jul 2013 12:19:23 GMT
  Expires:Tue, 23 Jul 2013 12:22:22 GMT
  Last-Modified:Tue, 23 Jul 2013 12:19:22 GMT
  Server:Microsoft-IIS/7.5
  <strong>Vary:Accept-Encoding</strong></p>
  
  <p>where what i want is</p>
  
  <p>Cache-Control:public, max-age=180
  Content-Encoding:gzip
  Content-Length:9741
  Content-Type:text/html; charset=iso-8859-1
  Date:Tue, 23 Jul 2013 12:19:23 GMT
  Expires:Tue, 23 Jul 2013 12:22:22 GMT
  Last-Modified:Tue, 23 Jul 2013 12:19:22 GMT
  Server:Microsoft-IIS/7.5
  <strong>Vary:User-Agent</strong></p>
  
  <p>thanks</p>