Wednesday, December 25, 2013

solve internet explorer compatibility Document Mode with asp.net pages

To solve the problem to document mode affects on interface of your aspx file design issues you can past the following configuration to your application web.config file to solve internet explorer compatibility document mode to be the last mode and ignore problem ie 7 document mode or other mode issues

<system.webServer>
    <httpProtocol>
      <customHeaders>
        <add name="X-UA-Compatible" value="IE=edge,chrome=1"/>
      </customHeaders>
    </httpProtocol>
</system.webServer>
------------------------------------------------------------

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

Tuesday, December 24, 2013

System.Web.HttpException : This is an invalid webresource request Clear Cach



this error solution according to post http://forums.asp.net/t/1609380.aspx
is to clear cach for your page request so the following code clear cach in client side just call the function in page load to solve the webresource.axd prbolem when change your application host from framework version to another or any updates affects on cached data on client side .


using meta Tag
<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />
 
Using Server side function
Public Shared Sub ClearCachForPage()
        HttpContext.Current.Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1))
        HttpContext.Current.Response.Cache.SetValidUntilExpires(False)
        HttpContext.Current.Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches)
        HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache)
        HttpContext.Current.Response.Cache.SetNoStore()

    End Sub