c# - prevent outputcache if request contains specific header-info -


I have a web application (IIS7, .Net4.5, C # and web forms) and output cache active.

The output cache anything except specific requests is working well do not want to hit me already output cached content with the specific header information, application examples have hit the business address pageload Is etc. For the current request with specific header information, T wants to prepare new output cached content, but the output cache should work for 'normal request' which does not have specific header information.

Currently if I use VaryByHeaders, an output capture version of the current page will be created. If its a lot of web-trophy can be a memory-intensive solution and it does not work for me for the current solution.

Is there any way to get this?

Thank you!

You can use

to check the AddValidationCallback method A system provides output cache in response to the client in response to the cache in response to the response cache. Before

The response from the Web server cache, no handler if registered handlers are inquiries to ensure the legitimacy of the resource is not a valid one sets flags indicating that cached response, Admission is not valid and has been expunged from the cache. In this case, when any handler indicates that the cached response should be ignored for this request, then the request is handled as if the cash was missed.

AddValidationCallback to .NET Framework Version 3.5

Add to your site's base page:

  public invalid page_load () {response. Catch Advanced Callback (new HTTP Cache Validation Handler (validcap), blank); } Public static void Vadkache (http blanket context, object data, ref Actiteepiwalideteshn status status) {validationstatus = context.Request.Headers [ "myheaders"] == "nocache"? HttpValidationStatus.IgnoreThisRequest: HTTP validity Status.Valid; }    

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -