[OutputCache] problem in Html.RenderAction()

Last post 10-14-2008 9:51 PM by levib. 4 replies.

Sort Posts:

  • [OutputCache] problem in Html.RenderAction()

    10-14-2008, 12:31 PM
    • Member
      10 point Member
    • mike108mvp
    • Member since 07-29-2008, 1:54 PM
    • Posts 22

    [OutputCache] problem in Html.RenderAction()

    When I use Html.RenderAction("AddProduct") in a view page  ~/Views/Product/Test.aspx, and the Action "AddProduct" has the [OutputCache]  attribute.

    The problem is that the Action "AddProduct"  's  [OutputCache]  attribute has affected the view page  ~/Views/Product/Test.aspx .

    Could you please tell me How to made the  Action "AddProduct"  's   [OutputCache] attribute do not affect the view page  ~/Views/Product/Test.aspx  that has Html.RenderAction("AddProduct") ?

  • Re: [OutputCache] problem in Html.RenderAction()

    10-14-2008, 2:23 PM
    • Contributor
      4,300 point Contributor
    • levib
    • Member since 07-23-2007, 7:50 PM
    • Redmond, WA
    • Posts 763

    This is a known issue, but unfortunately we don't yet have a solution for it.

  • Re: [OutputCache] problem in Html.RenderAction()

    10-14-2008, 2:34 PM
    • Member
      192 point Member
    • f00sion
    • Member since 05-28-2004, 5:58 PM
    • Irvine, CA
    • Posts 77

     No way around it without making a custom output cache attribute.

  • Re: [OutputCache] problem in Html.RenderAction()

    10-14-2008, 9:45 PM
    • Member
      10 point Member
    • mike108mvp
    • Member since 07-29-2008, 1:54 PM
    • Posts 22

    levib:

    This is a known issue, but unfortunately we don't yet have a solution for it.

    Will it be solved in the next version of MVC?  It's a critical issue for our MVC application.

  • Re: [OutputCache] problem in Html.RenderAction()

    10-14-2008, 9:51 PM
    • Contributor
      4,300 point Contributor
    • levib
    • Member since 07-23-2007, 7:50 PM
    • Redmond, WA
    • Posts 763

    mike108mvp:
    Will it be solved in the next version of MVC?  It's a critical issue for our MVC application.

    I don't know.  If this is blocking you, you have a few options.

    • Write a filter that performs caching, as suggested by an earlier poster.  Presumably such a filter would work by hooking into the response stream.
    • If you're implementing caching to work around database access, you could modify your model repository to look in a cache (such as that provided by ASP.NET) before looking in the database.
    • If only a particular part of your application requires partial view caching, you could use WebForms rather than MVC for that part of your application.

    I realize that these aren't particularly good options. :(  Depending on the complexity of your application, one of the first two methods should be sufficient.

Page 1 of 1 (5 items)