How to or disable C1ReportViewer Cache

Originally Posted 1 March 2013, 2:59 am EST

  • Originally Posted 1 March 2013, 2:59 am EST

    Hi ,

    I want to disable or clear the C1ReportViewer`s cache.

    I use the following code to make the cache disable:
    this.C1ReportViewer1.Cache.Enabled = false;
    this.C1ReportViewer1.Cache.ShareBetweenSessions = false;

    but it did not work.

    You can test it with the attachment.

    Kindly Regards
  • Reply

    Hi SankalpS?

    Thank very much for your reply.

    Can you tell me how to check the size of c1 reportviewer`s cache ?

    My test version is 4.0.20123.97.

    Please test with the attachment.
  • Reply


    You can check the Temporary ASP.NET files folder to check the size of the ReportViewer's cache. You can go to the following path on your machine. Please take care of the ASP.NET version which you are using for your application:
    C:WINDOWSMicrosoft.NETFrameworkv4.0.30319Temporary ASP.NET Files

  • Reply

    I am experiencing the same issue as AngryBird.

    setting the
    C1ReportViewer1.Cache.Enabled = false;
    C1ReportViewer1.Cache.ShareBetweenSessions = false; just DOES NOT WORK.

    When 2 different website users attempt to print the same report, e.g. a Sales Order, generated with the same data, and this is the crucial point, AT THE SAME TIME, ON TWO DIFFERENT MACHINES BROWSING THE SAME WEBSITE, then as often as not user one will get user two's order displayed and user two will get either user one's order, or more frequently an AJAX Error ZERO.

    One would expect the properties listed above to prevent behavior like this.

    Chicken Leg Willy (and I am angry too!)
  • Reply


    I checked the sample which you provided and found that during the initial report load on page report, the report did not load but threw an error saying that it could not find the "MostExpensive" report.

    I noticed that in the page_load itself you are calling the following line:

    This is not required since the next time you are loading a different report is on a button click. Once I removed this line, the sample worked fine for me. I did not face any issues with the report cache or viewing a different report after the first one. Could you please let me know if there is some different issue which you are referring to? I am currently running build 3.5.20123.96 of Wijmo.

  • Reply

    Hello Chicken Leg Willy,

    I apologize for the inconvenience caused due to this issue. I have escalated it to the concered team for review on priority and would get back to you as soon as I hear anything from them.

  • Reply

    A follow up to this thread by ChickenLegWilly

    I used the sample code provided by ComponentOne on this website and it is absolutely wrong. Oh, it works, sort of, until two different people try to print the report with different data simultaneously. It turns out that to prevent it from blowing up in a real world application, you must use session variable and include the SessionID in rendering and creating the report.
    Code that works for me is as follows:
    Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load

    If Not IsPostBack Then
    Me.C1ReportViewer1.Cache.Enabled = False
    Me.C1ReportViewer1.Cache.ShareBetweenSessions = False
    Session("rptpath") = HttpContext.Current.Server.MapPath("~/ReportLayout/OrderConfirmation.xml")
    Session("rptname") = "OrderConfirmation"

    Session("query") = "SELECT ..."
    Session("FileName") = Session("rptname") + Session.SessionID.ToString()
    Session("ReportName") = Session("rptname") + Session.SessionID.ToString() + "_" + Session("OrderNumber")

    C1ReportViewer.RegisterDocument(Session("FileName"), AddressOf MakeDoc)

    C1ReportViewer1.FileName = Session("FileName")
    C1ReportViewer1.ReportName = Session("ReportName")

    C1ReportViewer1.ExportedFileName = "Order " & Session("OrderNumber").ToString
    End If
    End Sub

    Protected Function MakeDoc() As C1PrintDocument
    Dim report As C1Report = C1ReportViewer.CreateC1Report()
    report.Load(Session("rptpath"), Session("rptname"))

    report.DataSource.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=MyDatabase;Data Source=MySQLServerInstance"

    report.DataSource.RecordSource = Session("query")
    Return report.C1Document

    Catch ex As Exception
    Me.lblRetryPrinting.Text = "A problem was experienced. Try to print using Account History"
    End Try
    End Function

    When testing this Users no longer get each other's documents, but once every 5-6 attempts during testing, One user will get the correct document and the other user will get a blank preview that states the document was completely generated. Upon leaving the page an AJAX Error(0) is displayed.

    The sad part is that it took over a month to get product support to understand the nature of the problem, and then 6 more weeks to get a reply with a sample that works so I could interpolate the correct way to do it . AND it is still not quite right, as mentioned above.
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels