locked
Microsoft.Reporting.WebForms; showing the previous parameter (cached) related report RRS feed

  • Question

  • User1052662409 posted

    Hello everyone,

    Here I came with a strange issue related to Microsoft.Reporting;

    Earlier I was using this dll (Microsoft.ReportViewer and related all dlls) using web forms to show some reports and it is working perfectly with no issue. I am sharing a small screenshot here.

    Capture

    Now I have converted my whole project from web forms to MVC 5 and hosted my project on Azure. The whole project is working fine.

    Now I am again using the same dll along with all associated dlls to implement the report section. Here it doesn't have any error and showing the report perfectly. 

    Now the issue comes in the picture. I m describing it here: Let's take 3 users to see the report at the same time. users A, B, and C.

    Suppose at very first user A logs in and opens a report for him/herself, it shows it belongs to use A, at the same time when user B tries to open the same report (by clicking the same link) it again shows the report with the name of use A; there is nothing related to user B.

    Again, if at a very first time If use B opens a report for him/herself it shows the report which belongs to user B, but if at the same time user C OR use A tries to open the report, it again shows the report for the use B (I can see the name of user B).

    I have gone through all my store procedures and c# code (with session variables) I did not find any wrong assignment for any variable for any user.

    Then I came with the output when every (any user from A to Z) comes first and opens the report it ALWAYS shows only the report for the very first user who opens the report.

    Then I (this is only an idea from my side) guess that the first user who opens the report, always replace his/her session with all other existing users or cached the first user's data to show I the report.

    I am getting all the reports withing a ViewBag (ViewBag.ReportViewer) and generating a report using the View below

    @using ReportViewerForMvc
    @{
        ViewBag.Title = @Session["WebsiteName"];
    }
    
     @Html.ReportViewer(ViewBag.ReportViewer as Microsoft.Reporting.WebForms.ReportViewer, new { @style = "font-size:9pt;font-family:Verdana", @Height = "642px", @ProcessingMode = "Local", @Width = "896px" })

    and below the aspx file which generated the report.

    <%@ Page Language="C#" AutoEventWireup="True" CodeBehind="ReportViewerWebForm.aspx.cs" EnableSessionState="True"  Inherits="ReportViewerForMvc.ReportViewerWebForm" %>
    
    <%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
    
    <!DOCTYPE html>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body style="margin: 0px; padding: 0px;">
        <form id="form1" runat="server">
            <div>
                <asp:ScriptManager ID="ScriptManager1" runat="server">
                    <Scripts>
                        <asp:ScriptReference Assembly="ReportViewerForMvc" Name="ReportViewerForMvc.Scripts.PostMessage.js" />
                    </Scripts>
                </asp:ScriptManager>
                <rsweb:ReportViewer ID="ReportViewer1" runat="server"   Font-Names="Verdana"
        Font-Size="9pt" Height="642px" ProcessingMode="Remote" Width="896px"></rsweb:ReportViewer>
            </div>
        </form>
    </body>
    </html>
    

    Please suggest.

    Thursday, September 10, 2020 6:12 PM

All replies

  • User475983607 posted

    Suppose at very first user A logs in and opens a report for him/herself, it shows it belongs to use A, at the same time when user B tries to open the same report (by clicking the same link) it again shows the report with the name of use A; there is nothing related to user B.

    Static variables and caching data commonly causes this type of issue.  We can't see how the ViewBag is populate and don't know how the security is designed.  I would start with reviewing the code that populates the ViewBag.  Is the data coming from a cache?  Are you using static variables anywhere in the code base?  How does security work?

    Thursday, September 10, 2020 8:12 PM