Active Server Pages Programming (ASP)/Crystal Report
Expert: Srini Nagarajan - 11/4/2005
Question-------------------------
Followup To
Question -
"Object reference not set to an instance of an object" error occurs when i simply places the CrystalReportViewer control in my web form. What is the reason and how it can be sorted out please guide me. Thanking you.
Regards
Girish
Answer -
hi
Did you added the crystal report in the reference?
Application can't find the CrystalReportViewer control... that's why you are getting this error
-Srini
Hello Sir,
I have added all the references required for crystal report in my application like Crystaldecisions.web.engine (or something like it); but still error occurs. Actually when i simply places the control in my web form, the required references are autometically added in reference. Now if there is a specific reference is to be added i am not aware of it. Please let me what is that? (For ASP.NET language is VB)
AnswerHi
Sorry for the delay...
This error message appears because there is no virtual directory for the Crystal Reports Web Forms Viewer for the web application's web site.
To resolve this error message, complete one of these steps:
• If the virtual directory for the Crystal Reports Web Forms Viewer exists under the Default Web Site, copy the virtual directory to the web application's web site.
- For Crystal Reports for Visual Studio .NET 2002 (9.1.3300.0) the virtual directory is CrystalReportWebFormViewer.
- For Crystal Reports for Visual Studio .NET 2003 (9.1.5000.0) the virtual directory is CrystalReportWebFormViewer2.
- For Crystal Reports 9 Developer or Advanced editions (9.2.3300.0) the virtual directory is crystalreportViewers.
- OR -
• If the virtual directory for the Crystal Reports Web Forms Viewer does not exist, create the directory using the following steps:
1. On the 'Start' menu, click 'Run', type "inetmgr", and then click 'OK' to load the IIS Manager.
2. Right-click the web site node associated with your web application.
3. Click 'New' and then click 'Virtual Directory'.
4. Click the 'Next' button.
5. Type the appropriate alias from the following list and then click the 'Next' button.
- For Crystal Reports for Visual Studio .NET 2002
(9.1.3300.0) type "CrystalReportWebFormViewer".
- For Crystal Reports for Visual Studio .NET 2003
(9.1.5000.0) type "CrystalReportWebFormViewer2".
- For Crystal Reports 9 Developer or Advanced
editions (9.2.3300.0) type "crystalreportViewers".
6. Browse to the viewer folder and click the 'Next' button:
- For Crystal Reports for Visual Studio .NET 2002
(9.1.3300.0) and Visual Studio .NET 2003 (9.1.5000.0) browse to 'C:\Program Files\Microsoft Visual Studio .NET\Crystal Reports\Viewers'
- For Crystal Reports 9 Developer or Advanced
editions (9.2.3300.0) browse to 'C:\Program
Files\Common Files\Crystal
Decisions\2.0\crystalreportviewers'
7. On the 'Access Permission' dialog box, click the 'Next' button to go to the last screen.
8. Click the 'Finish' button to exit the wizard.
Additional Information
--------------------------
If this error message still appears after creating the virtual directory, perform a Visual Studio .NET repair install to resolve this error.
If the Default Web Site does not exist in IIS, then create the following registry subkeys:
- For Crystal Reports for Visual Studio .NET 2002
Subkey: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Service
s\W3SVC\Parameters\Virtual Roots
Value: /CrystalReportWebFormViewer
Type string: c:\program files\Microsoft Visual Studio .Net\Crystal Reports\Viewers\,,201
- For Crystal Reports for Visual Studio .NET 2003
Subkey: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Service
s\W3SVC\Parameters\Virtual Roots
Value: /CrystalReportWebFormViewer2
Type string: C:\Program Files\Microsoft Visual Studio .Net\Crystal Reports\Viewers\,,201
- For Crystal Reports 9 Developer or Advanced editions
Subkey: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Service
s\W3SVC\Parameters\Virtual Roots
Value: /crystalreportviewers
Type string: C:\Program Files\Common Files\Crystal Decisions\2.0\crystalreportviewers,,201
Happy Programming!
-Srini