Skip to Content
0
Former Member
Nov 28, 2008 at 03:41 AM

Storing User ID and Password Information VS 2008 Best Practice

54 Views

Hi There,

I've just been going throug some of the examples for using CR 2008 in C#. They all seem to hard code the configuration e.g.

private void ConfigureCrystalReports()

{

ConnectionInfo connectionInfo = new ConnectionInfo();

connectionInfo.ServerName = "REMSOFT
SQL2005";

connectionInfo.DatabaseName = "CentralReportsDB";

connectionInfo.UserID = "CentralReport";

connectionInfo.Password = "StrongPassword";

string reportPath ="C:
Central Reporting
Central Reports
BuyerBySupplier.rpt";

crystalReportViewer.ReportSource = reportPath;

SetDBLogonForReport(connectionInfo);

}

I'm new to C# , so was wondering what is the best practice for storing this information in a WinForms app ?

I am using a SQL Server 2005 database and all the reports have been set up to run under a specific SQL user that only has select permisions on the stored procedures that the reports run against.

I have seen code that you can use to store the detailsin the config file, but it is not encrypted there, so the password is available to anyone. I don't really want users to have to type in the password (or even know what it is) each time. Any suggestions ?