cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

We developed ASP.Net application where we are using Crystal Report 2020 as reporting tool.

We deployed the application and installed CR Run Time (13.0.32.4286) in production server (Windows 2012 R2 with IIS 8).

When we preview the report and keep it open longer than 5 minutes then perform pagination we get an error

“Padding is invalid and cannot be removed.“

Attached below the Stack Trace:

<!--

Inner Stack Trace:

Stack Trace:

at System.Security.Cryptography.CapiSymmetricAlgorithm.DepadBlock(Byte[] block, Int32 offset, Int32 count)

at System.Security.Cryptography.CapiSymmetricAlgorithm.TransformFinalBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount)

at System.Security.Cryptography.CryptoStream.FlushFinalBlock()

at System.Security.Cryptography.CryptoStream.Dispose(Boolean disposing)

at System.IO.Stream.Close()

at System.IO.StreamReader.Dispose(Boolean disposing)

at System.IO.TextReader.Dispose()

at CrystalDecisions.Shared.EncryptionManager3.DecryptStringFromByte(Byte[] cipherText)

at CrystalDecisions.Web.ViewerGlobal.DeserializeBase64StringIntoObject(String base64String)

at CrystalDecisions.Web.CrystalReportViewerBase.LoadViewState(Object viewState)

-->

Please suggest how to go about it.

0 Likes
View Entire Topic
0 Likes

Hello,

I changed your Tag to CR for VS.

The issue is you need to use PostBack method to keep the report in scope.

protected void Page_Init(object sender, EventArgs e)
{
        //btnListReports_Click(sender, e);
    if (IsPostBack) // post back event, check if report is in session if it is view it.
    {
        rptClientDocMgd = (CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocument)Session["sesrptRCD"];
    }
}

You can search also for more details specific to your project and how you deal with it.

the important part is using PostBack to keep the report in session.

Have a great day

Don

debjyoti7
Explorer
0 Likes

Thank you for your feedback.

We have IIS Application Pool configurations as:

1. IIS Worker Process idle Time-out is set to “5” minutes and Idle Time-out Action is set to “Terminate”

2. Maximum Worker Process is set to 20

Now after 5 minutes when the IIS worker process gets terminated/recycled and user tries to navigate to next/previous page Crystal Report Viewer generates error

“Padding is invalid and cannot be removed.“

We resolved the above mentioned error by doing the following:

1. Introduced a registry key,”KeyPair” in the path “HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Crystal Reports”

2. Created two String Value IV and KEY under the above mentioned key.

We generated protected machine dependent AES KEY/IV using “AesCryptoServiceProvider” and further converting into Base64 string for the above string values.

We expected that this “KeyPair” should have been created during the time of Crystal Report 2020 runtime installation.

But this did not happen.

Please let us know if this is the right process or you can suggest any other best possible way.

W.r.t your previous solution we would like to inform you that we are not keeping the report object in the session as it increases the webserver load and moreover this error happens when the Crustal Report is trying to decrypt the viewer ViewState with a different auto generated key after the worker process is recycled.

Thanks