Quantcast
Channel: Crystal Reports
Viewing all articles
Browse latest Browse all 1507

Code behind is not run when URL is entered directly for a CrystalReport Viewer page

$
0
0

Hi All

I have a very strange problem. I have a web application that is used to display reports using Crystal Reports Viewer.

I have links on the master page that direct the user to the report viewer page which then load the report. Everything is working nice and dandy. 
The problem started to happen when we tried to enable some security. The way we did it is by having some code on the main page that checks if the user is allowed to view certian report or not, that also works fine when clicking on the links from the menu BUT if a user inputs the url directly (someone sent the url by email for example)  it would work. 
I did some debugging and found that if the user viewed another report to which he has access and then inputs the url directly it will load the report to which he has no access, the strange thing is that the code behind will NOT get executed at all (not the master page or the report viewer page).

This really drives me crazy! i have no idea how can a page load without executing any code.

Here is my code to load the report:

Dim rptDoc As ReportDocument = Nothing
        rptDoc = TryCast(Session("rptDoc"), ReportDocument)  'The report doc is created on the prev page
        CrRptViewer1.ReportSource = rptDoc

 


Viewing all articles
Browse latest Browse all 1507

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>