Click here to Skip to main content
15,302,644 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a CrystalReportViewer, and when I am using it to report a report, it automatically stores the rpt path in View state. On decoding the view state, the path of the rpt is visible. How to stop this?
On disabling View State for the CrystalReportViewer control, it stops displaying the rpt in the viewer screen. So an alternate solution to display the report after disabling the view state will also be helpful.

Thanks in advance

What I have tried:

<cr:crystalreportviewer id="ui_CrystalReportViewer" runat="server" autodatabind="true" separatepages="False" hasprintbutton="True" hasrefreshbutton="False" hascrystallogo="False" hastogglegrouptreebutton="false" enableparameterprompt="false" hastoggleparameterpanelbutton="false" toolpanelview="None" width="100%" bestfitpage="false" reuseparametervaluesonrefresh="true" viewstatemode="Disabled">
Posted
Updated 24-Jun-21 2:00am

1 solution

Unless a control is specifically written to function properly with ViewState disabled, you cannot disable its ViewState and expect it to work.

However, you can set the Page.ViewStateEncryptionMode property[^] to encrypt your ViewState field.

The path will still be stored in the ViewState, but you won't be able to decode it without the server's encryption key.
   
Comments
Member 15260864 25-Jun-21 3:29am
   
Thank you. It worked.

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