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

No comments:

Post a Comment