Last post Jul 19, 2013 04:35 PM by urir10
Jul 19, 2013 02:05 PM|urir10|LINK
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
Jul 19, 2013 04:32 PM|romy.thomas|LINK
Hi, Won't your session be null in case you are accessing the page directly by typing in url.?
Jul 19, 2013 04:35 PM|urir10|LINK
It would have the value of the other report viewed. The point is thou that the code behind is not executed and that the page should not be even loaded at all because the user doesnt have access to the URL