Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have a ASP.Net MVC appication, from one controller action I am calling another method, which is in another class, From that method I am calling another WebAPI action.

I have applied caching in the controller action using OutputCache attribute.

But the caching is not working when the action in the controller called for the second time it again calls the method, which is in another class and the WebAPI action is also being called from that method.

The following is the controller action.

C#
[OutputCache(CacheProfile = "MyCacheProfile")]
       public List<Students> GetStudents()
       {
           List<Students> studentsList =                             _studentServiceClient.GetStudentsBasedOnDept(DeptName);
           return studentsList;
       }



XML
<caching>
  <outputCacheSettings>
    <outputCacheProfiles>
      <add name="MyCacheProfile" duration = "3600" varyByParam = "none" location = "Server" noStore = "false" />
    </outputCacheProfiles>
  </outputCacheSettings>
</caching>



I have tried all locations Client, Server,ServerAndClient also tried nostore as true and false
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900