ASPHostCentral.com Crystal Report Hosting BLOG

All about Crystal Report 2010 Hosting and Crystal Report 2008 Hosting articles

ASPHostCentral.com - Steps in Changing Web Hosting Providers

clock October 3, 2011 18:45 by author Administrator

There are many reasons why individuals or companies want to change to a new web hosting company. It could be as simple as not enough storage space or bandwidth, or it could be due to its customer service, or lack thereof.

Easier said than done? Changing to a new web hosting company may sound like a daunting task, but it doesn't have to be that complex - there are just a few things to keep in mind.

1. Keep your web hosting account with your existing host open

It is recommend that you keep your existing web hosting account active until you have completed the transition steps (ie. new account setup, file transfer, email creation and setup, DNS modification and propagation).This will ensure that your website and domain email accounts will be running during the transition.

2. Choose a suitable new web hosting provider

Considerations include:

a) Type of OS (Windows vs. Linux) - it depends on the technologies your website requires. For example, if your website requires ASP, MSSQL, MSACCESS or other Microsoft-specific technologies, then you will need to find a Windows-platform web hosting plan.

b) Bandwidth and disk space requirements

3. Make a backup copy of your existing website: download old account files

Ideally, files should be downloaded in the same tree structure in which you want to upload it later. Also look for any file or chmod permissions that you might to set on any folder or file. This is a fairly easy task and can easily be accomplished by FTP.

However, some free web hosting providers do not offer FTP access. This is especially true if you're currently using a free Flash/drag-and-drop website creation service (ie. Weebly.com, WIX.com).

If this is the case, you will not be able to download your existing web files and will have to re-create your new web files. You should check to see if your new web hosting provider offers a free website creator.

To avoid running into the same problem in the future, make sure your new web hosting provider offers FTP access.

4. Setup new (same) email addresses

To ensure that emails are properly received, it is important to keep the same email addresses, including email aliases and forwarders.

5. DNS changes and propagation

Once you have uploaded your web files to the new web hosting server and re-created your email accounts, you can go ahead and make the necessary domain name server (DNS) changes.

DNS is usually obtained once you have signed up with the new web hosting provider. You will need to replace your existing DNS settings with the new one - this is usually done via your domain management panel (your domain registrar).

The new DNS will take anywhere between 24-48 hours to propagate, therefore the old web host is responsible for website and email in the meantime. This is why cancelling the old service should be the very last thing to do.

6. Cancel your old account.

Once your new account has been activated and your website and email services at your new web hosting provider are up and running, you can proceed to have your old account cancelled.



If you need assistance in migrating your website to a new host, you can contact ASPHostCentral.com. We offer migration assistance FREE of CHARGE

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


ASP.NET Hosting :: Things to AVOID in JSON serialization

clock September 12, 2011 16:01 by author Administrator
If you’ve spent much time working with the .NET platform, ASP.NET’s simple, convention-based approach to exposing JSON endpoints seems just about too good to be true. After years of fiddling with manual settings in XML configuration files, it’s understandable to assume that working with JSON in ASP.NET would require a similar rigmarole, yet it does not.Unfortunately, this unexpected ease-of-use isn’t obvious if you don’t already know about it, which has led some developers to build needlessly complicated solutions to problems that don’t actually exist. In this post, I want to point out a few ways not to approach JSON in ASP.NET and then show you a couple examples of leveraging the frame work to do it “right”.

A couple examples of what NOT to do

To show you exactly what I’m talking about, let’s start by looking at a few concrete examples of ways that you should not handle sending and receiving JSON in your ASP.NET services.For all the examples, we’re going to be trying to send and/or receive instances of this Person class:
public class Person
{
  public string FirstName { get; set; }
  public string LastName { get; set; }
}
Once you progress beyond simple scalar types, sending objects (and collections of them) back and forth is a pretty logical next step, and that’s also the point where this manual serialization trouble seems to begin. So, working with this simple Person class should serve as a realistic example, without being overly complex.

Manual serialization, using JavaScriptSerializer

The most common variant of this mistake that I’ve seen is using JavaScriptSerializer to manually build a JSON string and then returning that string as the result of a service method. For example, if you didn’t know better, you might do this to return an instance of the Person class:
[ScriptService]
public class PersonService : WebService
{
  [WebMethod]
  public string GetDave()
  {
    Person dave = new Person();
 
    dave.FirstName = Dave;
    dave.LastName = Ward;
 
    JavaScriptSerializer jss = new JavaScriptSerializer();
 
    // Results in {"FirstName":"Dave","LastName":"Ward"}
    string json = jss.Serialize<Person>(dave);
 
    return json;
  }
}
This may look sensible enough on the surface. After all, the json variable does end up containing a nicely serialized JSON string, which seems to be what we want. However, you should not do this.

What actually happens

Part of the beauty of using ASP.NET’s JSON-enabled services is that you rarely have to think much about the translation between JSON on the client-side and .NET objects on the server-side. When requested with the proper incantations, ASP.NET automatically JSON serializes your service methods’ responses, even if their result is an object or collection of objects.Unfortunately, that automatic translation also makes it easy to end up with doubly-serialized responses if you aren’t aware that ASP.NET is already handling the serialization for you, which is exactly what would happen in the preceding example. The end result is that the Person object is serialized twice before it gets back to the browser – once as part of the method’s imperative code and then a second time by convention.In other words, it’s understandable to expect the previous code example would return this response:
{"FirstName":"Dave","LastName":"Ward"}
But, what it actually returns is this:
// All the quotes in the manually generated JSON must be escaped in 
//  the second pass, hence all the backslashes.
{"d":"{\"FirstName\":\"Dave\",\"LastName\":\"Ward\"}"}
What a mess. That’s probably not what you had in mind, is it?

Using DataContractJsonSerializer or Json.NET is no better

This may seem obvious, but I want to point out that using a different manual serialization tool, like WCF’s DataContractJsonSerializer or Json.NET, in place of JavaScriptSerializer above does not remedy the underlying problem. I only mention it because I’ve seen those variations of the mistake floating around too.If anything, in the case of DataContractJsonSerializer, it’s even worse. DCJS’ handling of Dictionary collections and Enums makes life unnecessarily tedious at times, and the code to manually invoke it is even more verbose than that for JavaScriptSerializer.

The impact this mistake has on the client-side

If it weren’t bad enough to add extra computational overhead on the server-side, cruft up the response with escaping backslashes, and increase the size of the JSON payload over the wire, this mistake carries a penalty on the client-side too.Most JavaScript frameworks automatically deserialize JSON responses, but (rightfully) only expect one level of JSON serialization. That means that the standard functionality provided by most libraries will only unwrap one level of the doubly serialized stack of JSON produced by the previous example.So, even after the response comes back and your framework has deserialized it once, you’ll still need to deserialize it a second time to finally extract a usable JavaScript object if you’ve made the mistake of manually serializing. For example, this is code you might see to mitigate that in jQuery:
$.ajax({
  type: 'POST',
  dataType: 'json',
  contentType: 'application/json',
  url: 'PersonService.asmx/GetDave',
  data: '{}',
  success: function(response) {
    // At this point, response is a *string* containing the
    //  manually generated JSON, and must be deserialized again.
 
    var person;
 
    // This is a very common way of handling
    //  the second round of JSON deserialization:
    person = eval('(' + response + ')');
 
    // You'll also see this approach, which
    //  uses browser-native JSON handling:
    person = JSON.parse(response);
 
    // Using a framework's built-in helper 
    //  method is another common fix:
    person = $.parseJSON(person);
  }
});
Regardless of which approach is used, if you see code like this running after the framework has already processed a response, it’s a pretty good indication that something is wrong. Not only is this more complicated and verbose than it needs to be, but it adds additional overhead on the client-side for absolutely no valid reason.

Flipping the script (and the JSON)

Redundant JSON serialization on responses is definitely one of the most common variations of this problem I’ve seen, but the inverse of that mistake also seems to be an alluring pitfall. Far too often, I’ve seen service methods that accept a single JSON string as their input parameter and then manually parse several intended inputs from that.Something like this to accept a Person object form the client-side and save it on the server-side, for example:
[ScriptService]
public class PersonService : WebService
{
  [WebMethod]
  public void SavePerson(string PersonToSave)
  {
    JavaScriptSerializer jss = new JavaScriptSerializer();
 
    Person p = jss.Deserialize<Person>(PersonToSave);
 
    p.Save();
  }
}
Just as ASP.NET automatically JSON serializes responses on its JSON-friendly services, it also expects that the input parameters will be in JSON format and automatically deserializes those on the way in. So, in reverse order, the approach above makes a mistake similar to the ones shown earlier.To make this work, we’d need to pass in JSON that looks something like this, obfuscating the actually desired input parameters inside a single, doubly-serialized string parameter.
{"PersonToSave":"{\"FirstName\":\"Dave\",\"LastName\":\"Ward\"}"}
Through the convenience of JSON.stringify(), it’s not even terribly hard to stumble onto a process for cobbling that double-JSON structure together on the client-side and making this approach work. I strongly recommend against it though. Even if the double-JSON didn’t carry extra overhead in several aspects, having a single input parameter of type string on this method is misleading. A year from now, will anyone realize what type of parameter that method accepts without looking down into the manual parsing code? Probably not.

Doing it right

Briefly, here are what I suggest as better ways to handle passing our Person object in and out of ASP.NET services.

Returning an object

Returning a .NET object from ASP.NET services is incredibly easy. If you let go and just trust the service to handle JSON translation for you, “it just works”:
[ScriptService]
public class PersonService : WebService
{
  [WebMethod]
  public Person GetDave()
  {
    Person dave = new Person();
 
    dave.FirstName = Dave;
    dave.LastName = Ward;
 
    // So easy!
    return dave;
  }
}
As long as you call that service method through a ScriptManager’s service proxy or using the correct parameters when using a library like jQuery, ASP.NET will automatically serialize the Person object and return it as raw, unencumbered JSON.

Accepting an object from the client-side

Accepting a Person object from the client-side works identically, in reverse. ASP.NET does a great job of matching JSON-serialized request parameters to .NET’s types, collections, and even your own custom objects.For example this is how you could accept a Person object, which would even then allow you to call that object’s custom methods:
[ScriptService]
public class PersonService : WebService
{
  [WebMethod]
  public void SavePerson(Person PersonToSave)
  {
    // No, really, that's it (assuming Person has a Save() method).
    PersonToSave.Save();
  }
}
 

 

Currently rated 1.7 by 23 people

  • Currently 1.652173/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Crystal Report Hosting :: Dynamic Images at runtime in Crystal Report XI using ASP.Net 2.0

clock June 9, 2011 17:46 by author Administrator

This article helps to display dynamic Images in crystal report Using ASP.Net 2.0.

We can use two methods to dynamically change the picture in the crystal report either the Image stored in the database as a BLOB and as a picture available in the local path.

Method I: Using recordset

1. Add a recordset and add a table in that. Add a column of System.Byte[] (Only System.Byte is available in the data type of data Table, Manually add the System.Byte[] in that. System.Byte not allowed for images).Then use the below code

2. Design the report with that dataset. You can add this System.Byte[] column as part of your main data table which have the all data or add a separate data table with a System.Byte[] and a key column that link to the main data table.

3. Add the below code

private ds_Images Images1;
rptTest crReportDocument = new rptTest(); // rptTest is your crystal report name

protected void btnShowReport_Click(object sender, EventArgs e)
{
ImageTable(); crReportDocument.Database.Tables["tblImages"].SetDataSource(Images1.Tables[0].DataSet);
string ExportPathFinal;
ExportPathFinal = ExportPath + "\\" + "TEMP" + "\\";
if (Directory.Exists(ExportPathFinal) == false) Directory.CreateDirectory(ExportPathFinal);

//Export Crystal Report to PDF
ExportOptions crExportOptions = new ExportOptions();
DiskFileDestinationOptions crDiskFileDestinationOptions = new DiskFileDestinationOptions();
crExportOptions = crReportDocument.ExportOptions;
crDiskFileDestinationOptions.DiskFileName = ExportPathFinal + "MyreportTest.pdf";

//Set the required report ExportOptions properties
crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
crExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; // Or any other Format
crExportOptions.DestinationOptions = crDiskFileDestinationOptions;
crReportDocument.Export();

string ExportPathFinal1 = ExportPath1 + "\\" + "TEMP" + "\\";
string pathToPDFfile = ExportPathFinal1 + "MyreportTest.pdf";
Response.Redirect(pathToPDFfile, true);
//Close and dispose of report
crReportDocument.Close();
crReportDocument.Dispose();
GC.Collect();
}

private void ImageTable()
{
ds_Images Images1 = new ds_Images();
string fileName = @"\\img\a.JPG";
fileName = Server.MapPath(fileName.Trim());
DataRow row;
Images1.Tables[0].TableName = "tblImages";
Images1.Tables[0].Columns.Clear();
Images1.Tables[0].Columns.Add("img", System.Type.GetType("System.Byte[]"));
row = Images1.Tables[0].NewRow();
FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fs);
row[0] = br.ReadBytes(Convert.ToInt32(br.BaseStream.Length));
row[1] = 1;
Images1.Tables[0].Rows.Add(row);
br = null;
fs.Close();
fs = null;
}

Method II: Using Picture Object of Crystal Report

Using the Dynamic Graphic Location of picture OLE object of crystal report, we can change picture dynamically at run-time.

1. Create a parameter field in the report with string data type.
2 In the report Add a picture OLE object. inside report right click->Insert->OLE object- >select Bitmap Image
3 Right click the OLE picture object and select Format Object- >select Picture tab ->Graphic location -> inside it drag the parameter field.

in the front end just pass the Image URL to the report

ParameterDiscreteValue crParameterimgLocation;
string img_url = @"\\images/newImages/nevadadot.JPG";
img_url = Server.MapPath(img_url);
crParameterField = crParameterFields["imgLocation"];
crParameterValues = crParameterField.CurrentValues;
this.crParameterimgLocation = new ParameterDiscreteValue();
this.crParameterimgLocation.Value = img_url;

//Add current value for the parameter field
crParameterValues.Add(crParameterimgLocation);

Note: while passing the Image URL do not put put single quotes.

We can use either method to display the Images in the report dynamically.

In Crystal Reports XI, the 'Dynamic Image Location' feature does not work with images in GIF format. Why does this behavior occur and how can you resolve it?" This drawback matches to the recordset method too.

"To debug the issue

This behavior occurs because Crystal Reports XI does not fully support the GIF file format. To resolve this behavior, use a supported image format when working with the 'Dynamic Image Location' feature. Supported image formats are Joint Photographic Experts (JPG), bitmap (BMP), Tagged Image File Format (TIF) and Portable Network Graphics (PNG)."

Any comments appreciated

Currently rated 1.5 by 4 people

  • Currently 1.5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Crystal Report v13 Hosting with ASPHostCentral.com

clock May 11, 2011 20:28 by author Administrator
ASPHostCentral.com, a premier provider in advanced Windows and ASP.NET hosting service, proudly announces the availability of the latest Crystal Report v13 hosting on our newest Windows Server 2008 Hosting Platform.

You can start hosting your Crystal Report v13 project on our environment from as just low as $4.49/month only. For more details about this product, please visit our product page at
http://www.asphostcentral.com/Crystal-Report-2010-Hosting.aspx     

"
Crystal Reports has been a part of Visual Basic since 1993, and a part of Visual Studio since its first release in 2002. Crystal Reports has been a very successful component of these products. With the release of Visual Studio 2010, SAP and Microsoft have mutually decided to change how we deliver this important component to the .NET developer community going forward," said Tom Heinrich, General Manager of ASPHostCentral.


Crystal Reports for Visual Studio 2010 will contain many new features compared to Crystal Reports Basic for Visual Studio 2008
," said ASPHostCentral.com Senior Support Specialist, Ryan Dalgish.

The demonstrations can be found at 
http://crystalreportdemo.ASPHostCentral.com/

For more details, please visit:
http://www.asphostcentral.com/Joomla-Hosting.aspx  


About ASPHostCentral.com:
ASPHostCentral is a premier web hosting company where you will find low cost and
reliable web hosting services. Whether you're an enterprise level business or a small business entity or someone who just wants to host his own personal website - we have a suitable web hosting solution for you.
For more information, visit
http://www.ASPHostCentral.com

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


How to solve the error message "Failed to create the Crystal Query Engine"

clock April 25, 2011 19:57 by author Administrator
Symptom:
When attempting to run a report, an error message states: 'Failed to Create the Crystal Query Engine'.

Solution 1:
There may be mismatched Crystal report DLLs in the system32 directory.
Rename the CRPE32.DLL file in the C:\Windows\System32 directory to CRPE32.DLL.OLD and reinstall the program.  A new CRPE32.DLL file will be installed that should match all the other dll versions.

Solution 2:

You may have Crystal Reports installed and the dll needs to be re-registered.
1. Quit Crystal Reports.
2. On the Windows taskbar, click the 'Start' button and then click 'Run'.
3. Type: 'regsvr32 "C:\Windows\System32\crqe.dll"'.
4. Click 'OK'.

A message appears indicating the file is successfully registered. If the file does not register correctly, try solutions 2.

Note:
You may need to locate the crqe.dll if it is not in the c:\windows\system32 direcotry. In this case, on the Windows taskbar, click the 'Start' button > Find (or Search) > Files and Folders. Enter crqe.dll and perform search. Note the location and substitue the path to register this file.
 

Currently rated 1.5 by 37 people

  • Currently 1.540541/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Crystal Report Hosting :: How To Solve the Error Message “Could not load file or assembly CrystalDecisions.Web….”

clock April 17, 2011 17:56 by author Administrator
"Could not load file or assembly 'CrystalDecisions.Web, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified."

Error message show when try to deploy web application to 64 bit Windows server 2008 R2 server. 

"Could not load file or assembly 'CrystalDecisions.Web, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified."

This is not easy for us to debug because we already install crystal report runtime in the server. But wait ... what is the problem then? version? yes, the version for the runtime installed is 10.5.3700.0 which i get from my machine:

C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\CrystalReports10_5. 

So, how to get crystal report runtime 10.2.3600.0 version? We can download from 
http://resources.businessobjects.com/support/additional_downloads/runtime.asp#07

So, beware of the different version of crystal report runtime. Hope this help 

Currently rated 1.5 by 4 people

  • Currently 1.5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Crystal Report Hosting :: Solving the Issue with the Maximum report processing jobs limit in Crystal Report

clock April 4, 2011 17:44 by author Administrator

This is a very common error in Crystal Report when its give this following message.

"The maximum report processing jobs limit configured by your system administrator has been reached."

I have been read about its on lot forums and new groups. Its actually means that Crystal Report print job limit has been reached and you should handle this problem by increasing the job limit in the registry. The basic reason of this problem is Garbag Collector (GC) cannot clear the reference of report document in their collection process its only clear report viewer.

HKEY_LOCAL_MACHINE\SOFTWARE\CRYSTAL DECISIONS\10.0\REPORT APPLICATION SERVER\SERVER\PrintJobLimit

Yesterday we also facing this problem in our application and after lot of discussion in the team we find out a good solution of this problem in the form following factory class because we not facing this problem in whole application.

 

You can use this ReportFactory class for creating ReportClass object and don’t need to call explicitly dispose method on the page because ReportFactory class will automatically dispose it when count reach to 75.

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Crystal Report Hosting :: Crystal Reports in ASP.NET Web Applications

clock March 30, 2011 15:34 by author Administrator
Introduction

Crystal Reports is the built-in report designing tool in Visual Studio .NET and it is fully integrated with windows and web applications. It is very easy to use and design the reports with it. To add a report to a visual studio .NET projects (windows or web) you just need to right-click on the project name and add new Items, and add the crystal report from the list. As a result Visual Studio adds a report to the project and opens the report designer to let you design and edit the reports.

 In this article, we are not planning to get into the details of Crystal Reports. Every single kid can open Crystal Report and play with it to design some simple reports (definitely you need to know a lot about crystal to design a professional report but currently that is not our main topic). There are lots of complains about crystal reports from the programmers that this feature is NOT working properly and we see even more complains when developers try it for the web application. We plan to give you and overview and a walkthrough code on how to use crystal reports in the web applications.

Data flow in .NET applications

To understand where the problems come from with this beautiful feature added to Visual Studio .NET we need to understand how the data is transferred from the data provider (SQL Server) to CrystalReportViewer Object. Imagine we are using ADO .NET to get a subset of data from SQL Server and store it in a DataSet. Then we conduct the data from dataset to CrystalReportViewer object to be displayed.

SQL Server -> SQLConnection -> SQLDataAdaptor -> DataSet -> CrystalReportDocument -> CrystalReportViewer -> ASP .NET web page

Hey, what's going on here!? Yes, in .NET application Crystal Report Document reads the data from dataset, NOT directly from data provider and this is the key point to Crystal Report integration with .NET. As a result to open Crystal Reports into a web page we need to follow these steps:

1. Populating DataSet in the same way that we do it in ADO .NET Disconnected scenario.
2. Creating the CrystalReportDocument Object and introducing populated DataSet as it's report source.
3. Redirecting the generated report to CrystalReportViewer web control that is provided by ASP .NET.

Let's do it


Ingredients:

1. Visual Studio .NET or Visual Studio 2003
2. SQL Server 7.0/2000 (If you use MSDE you need to restore Northwind Database, it is not included in MSDE)
3. Microsoft windows XP Professional or 2000 (If you have problems running this code on Windows 2003 server send contact us)

Recipe

1. Preparing SQL Server to run ASP .NET Application
Open the SQL Server Enterprise manager, Expand SQL Server Group -> Computer Name -> Security. Then right-click on logins and New Login... . On General tab click on ellipses in front of the name textbox. Select ASPNET and click on Add, the press OK to add ASPNET account to logins. Then click on Database Access tab and check Northwind in the list. Press OK and make sure if the <ComputerName>\ASPNET account ( add <ComputerName>\IIS_WPG in windows 2003 server instead) is added to logins list. You don't need to give any other permission. Public user has read and write permission to Northwind Database.

2. Creating a New ASP .NET web application
Run the visual Studio .NET and Create a new project. In the project types select Visual Basic Projects, and for the template select ASP .NET Web Application. Change the location to http://localhost/CrystalRepSample and click OK.

3. Connecting the application to Northwind Database in SQL Server and filling the DataSet with Northwind data.
- Open the server explorer (Ctl+Alt+S), right-click on Data Connections, and then Add Connection, for the server name type localhost or (local) or the SQL Server instance name. Select Use windows NT Integrated security and then select Northwind from Select the database on the server.
- In the server explorer expand the newly created connection to Northwind, expand the Tables and the drag the products table and drop it on the form. This creates an SQL ServerConnection object to Northwind as ServerConnection1, and the SQLDataAdaptor1 to pump the data to the DataSet that we are just about to create.
- Right-click on the SQLDataAdaptor1 and click on Generate DataSet... and then in the Generate Dataset dialog box just accept the defaults and click OK. The DataSet11 will be added to your form.
- Double-Click on the Webform1 that will open the webform in code view. In the page load event add the proper code to populate the dataset using SQLDataAdaptor1 as following:
     SqlDataAdapter1.Fill(DataSet11, "Products")
- Now we have a dataset with data that we can provide the data to report designer.

4. Creating the report with Crystal Designer
- In the project menu select Add New Item...
- In the templates box select Crystal Report, change the name to rpProducts.rpt and and click Open.
- To save the time just accept the Report Expert and standard report and press OK.
- In the Standard report expert dialog box in the available data sources expand project data. Expand ADO .NET DataSets and expand CrystalRepSample.DataSet1, you will find Products table in there. Select it and click insert table. Then click Next.
-  In the Fields tab just select some fields and click Add.
- Just click on Finish button and your report is ready.
- At the moment we have a report that reads data from an ADO .NET DataSet

5. Creating the web interface to present report
- Open the Webform1.aspx in design mode.
- Click on a white space on the form and the in the properties window set the pageLayout to FlowLayout. (This step is very important because we are using as Web Custom Control)
- Go to the toolbox and click on Web Forms then select CrystalReportViewer from the list and drag and drop it in the webform1.aspx. CrystalReportViewer1 will be added to the form.

6. Providing the data to report
- Open webform1.aspx in Code View and go to Page_Load sub.
- AFTER the line of code that you have already added, add the following code

Dim cr As New rpProducts() ' Creates the ReportDocument object
cr.SetDataSource(DataSet11) ' Defines the source of data for report which is DataSet11
CrystalReportViewer1.ReportSource = cr ' Makes the ReoprtViewer web control to know it's report source
CrystalReportViewer1.DataBind() ' You need to remind CrystalReportViewer1 that there is some data. Update the interface
 

7. Building and testing the application
Just press Ctl +F5 to build and run the application




Currently rated 1.4 by 7 people

  • Currently 1.428571/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Crystal Report Hosting :: Solving the Login Failed Error in Crystal Reports

clock March 14, 2011 17:48 by author Administrator

Introduction

In his “Troubleshooting Database Login Errors using Crystal Reports with .NET,” Eric Landes points out that he sees questions regarding the “Exception Details: CrystalDecisions.CrystalReports.Engine.LogOnException: Logon failed” message quite often in the newsgroups.  That's an understatement.  Since I use the “push” method (generating an ADO.NET dataset first, then setting the report's DataSource), I never saw this error, but I decided to try and replicate the problem to see why this was happening--it seems to be a popular error.  I had a suspicion that impersonation and the “double hop“  (where the ASP.NET application cannot pass the user's credentials) may play a role in this problem, since the methods in Eric's article don't solve the problem for every user it should.

To replicate the problem, I used an ASP.NET project connecting to either a remote production SQL Server database or a copy of the same database on my development machine (SQL Server Developer Edition).  I created a stored procedure that was just a simple SELECT statement, and used this stored procedure as my report source (“pull“ method).  I probably created this report 20 different ways, testing various options, and here's what I found.

Lesson 1: Integrated or SQL Server Security

When you begin to design your report, you are prompted to connect to the SQL Server database when you choose an OLEDB connection (CR.NET doesn't use ADO.NET, and ODBC requires a system DSN).  Your choices are to use Integrated Security or to enter a user ID and password.  If you choose Integrated Security, Visual Studio will use your credentials to connect to the SQL Server database via Windows Authentication.

If you choose to enter a user ID and password, VS will connect using SQL Server authentication.  You cannot enter another domain account in the user ID and password boxes and connect using those credentials via Windows Authentication.  This information in these textboxes can only be used for SQL Server authentication.  Even though you must enter a password at this stage, the password information is not stored within the report file for security reasons.  The password is only used to establish the database connection.  This means you must apply logon information to each table at runtime as shown in Eric's article.

The security method you choose at this point is the security method you must use when you generate your report, as we'll see in Lesson 2.

Lesson 2: Only One Security Model Allowed

The Crystal Reports engine cannot switch from Integrated Security to SQL Server security.  This means that if you design your report using Integrated Security, you must supply a domain user's credentials in code to log on to the SQL Server (you can change the user, but it must be a domain account).  If you will be using a SQL Server account in production, it is very important that you use this account's credentials to connect to the database during the design phase.

The CR designer caches database connection information, so I have found it best to completely delete all current connections and then exit and reopen Visual Studio before designing my report.  I could then make a fresh connection to the database using the credentials I wanted.  You can check by right-clicking the connection in Server Explorer and choosing “properties.”  If you're using a SQL Server account, you'll see a user name; if using Integrated Security, the user name will not appear.

When using SQL Server authentication, I found it was also best if there was a SQL Server login account with the same user name on my dev database as well as the production database.  You should be able to use a different SQL Server account in production than in development, but I had occasional problems I couldn't explain when I tried to do so.

Lesson 3: Credential Delegation/Impersonation ("Double Hop")

Integrated Security can only be used in two contexts: when inside Visual Studio (which, since it is a Windows Application, can directly use your network token to connect to the remote database), or when IIS and SQL Server are on the same production machine.  If you try to use Integrated Security on a production IIS Server with a remote SQL Server, you will get the “Logon Failed” error.  This is because the application cannot impersonate your credentials from the IIS Server to the SQL Server (the “double hop”) without Kerberos or some sort of delegation set up.

Kerberos is running on the network I tested, and normal ASP.NET apps impersonate my credentials to the SQL Server, so it appears that the Crystal Reports engine cannot take advantage of Kerberos.  Not every network has Kerberos running, so if in doubt, ask the network admins.

When testing whether or not the Crystal engine could use impersonation, I tried both specifying my user name and password in the web.config file as well as leaving the information blank (and the ASP.NET worker process would use the current login credentials).  In both cases, the report was unable to connect to a remote SQL Server database.  The CR engine could connect to a database hosted on the same machine.

If you are using the pull method, this means your only option to connect to a remote SQL Server is to create a new SQL Server login with minimum permissions (note: do not use 'sa' or some other administrative login--this is a bad security practice), and use that login's credentials in your code.  This is actually not a bad thing at all, but I could not find mention of this in any Crystal documentation.

Lesson 4: Design Changes Sometime Cause Login Failure

Sometimes, after making small changes (such as removing a field from the report), I would get the “logon failed” error.  I found that after verifying the database (right-click on report, choose Database >> Verify Database) and recompiling the project, the problem went away.

Conclusion

This article is not an all-encompassing list of causes for the "login failed" error.  This error is pretty general and may be thrown for reasons other than login credentials.  In these cases, knowing some of the causes for this error may save you some debugging time.

Before starting a Crystal Reports application in ASP.NET, you need to give some thought as to the security context your application will be running under.  In addition to data security and application security, you must also consider how the report will connect to the database.

Personally, I still prefer the push method.  Since this method uses ADO.NET datasets, it can take advantage of the optimzed System.Data.SqlServer class for better performance, and security is handled in the connection string or by application impersonation as specified in the web.config file.

Currently rated 2.9 by 21 people

  • Currently 2.904762/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Crystal Report 2010 Hosting with ASPHostCentral.com

clock January 13, 2011 14:31 by author Administrator

ASPHostCentral.com offers the latest Crystal Report for Visual Studio 2010 application to all our new and existing customers. This application must be request via our Help Desk System and it will be ready between 1 to 24 hours. What you need to make sure is that you understand the requirements for installing the application itself (such as whether SQL database is needed, etc).

Crystal Reports has been a part of Visual Basic since 1993, and a part of Visual Studio since its first release in 2002. Crystal Reports has been a very successful component of these products. With the release of Visual Studio 2010, SAP and Microsoft have mutually decided to change how we deliver this important component to the .NET developer community going forward

Crystal Reports for Visual Studio 2010

Starting on Friday, April 16th, the beta version of Crystal Reports for Visual Studio 2010 will be available as a separate download from this site. Just like when Crystal Reports was integrated into the Visual Studio installation, this download will continue to be free

Crystal Reports for Visual Studio 2010 will contain many new features compared to Crystal Reports Basic for Visual Studio 2008. This blog on the SAP Developer Network goes into more detail on the new features and how they benefit report designers, .NET developers, and report consumers

Both SAP and Microsoft believe this change in delivery method will allow for faster innovation of our respective products, and more value for our mutual customers   

Crystal Report 2010 Product Demonstrations

ASPHostCentral.com provides a demonstration or showcase of Crystal Report to all our customers. This demonstration is to show that we are able to host Crystal Report 2010, Crystal Viewer and other underlying Crystal Report components. The demonstration of Crystal Report can be found at: http://crystalreportdemo.ASPHostCentral.com

Currently rated 2.0 by 30 people

  • Currently 2/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Crystal Report Hosting

ASPHostCentral is a premier web hosting company where you will find low cost and reliable web hosting. We have supported the latest Crystal Report 2010 (v13 and v14) hosting. We have also supported the latest ASP.NET 4.5 hosting and ASP.NET MVC 4 hosting. We have supported the latest SQL Server 2012 Hosting and Windows Server 2012 Hosting too!

 

Sign in