ASP.NET and the output cache - how can I see if it works?

Problem . I have an ASP.NET website and I do not believe that my code correctly gets OutputCached. I use IIS7 performance counters to show me hits or skip a second.


I have a simple ASP.NET MVC website. I use the built-in magic of ASP.NET output cache.

Here is a sample code: -

[AcceptVerbs(HttpVerbs.Get)]
[ApiAuthorize]  // <-- this checks the querystring for a "key=1234". 
                // Doesn't find it, then it throws a 401 NOT AUTH exception.
[OutputCache(CacheProfile = "HomeController_Foo")]
public ActionResult Foo(string name, byte? alpha, byte? beta)
{
}

therefore this means that each url request may look like this: -

Now notice how I got OutputCache referencing the configuration file? here it is...

<caching>
    <outputCacheSettings>
        <outputCacheProfiles>
            <add name="HomeController_Foo" duration="3600" varyByParam="key;name;alpha;beta"/>
        </outputCacheProfiles>
    </outputCacheSettings>
</caching>

Nothing complicated ...

! , IIS7, , / / 100% , . 0/.

- , . , ? . , , . , BOUND . IIS .

.

, ....

... "hello + world" , IIS .

, ? - , , ? , , .

+3
2

, , : cookie , . outputcache (http) , , . .

+7

, firebug, . 200 304, (304) (200).

+1

Source: https://habr.com/ru/post/1719210/


All Articles