Blog moved to a new address



This blog was merged to my personal one, for future freeware updates please check http://www.stefanprodan.eu/

Recommended: Lokad Shared Libraries

Lokad Shared Libraries is a set of helper assemblies for .NET 3.5 and Silverlight 2.0. They are being developed as part of the Open Source effort by Lokad and are distributed under the new BSD license.

Lokad.Shared.dll hosts various Application Blocks, helper classes and generic interfaces.

I highly recommend the usage of Action Policies and Exception Handling

Make Report Viewer Control work with Sql Server 2008

Since it's first version, Reporting Services was a tricky tool to work with, the biggest problem was embedding a report into your custom Asp.net application. In order to solve this problem Visual Studio 2008 comes with a new control named ReportViewer that works on Windows Forms and Asp.net.
ReportViewer control has two ways of processing reports:

  1. Local mode (using the new report designer from VS.NET 2008 you can create .rdlc files and host them directly in your app)
  2. Remote mode (using the Report Designer that comes with SQL Server 2008 you can create .rdl files that are hosted on your IIS Server, those reports can be embedded in your app using ReportViewer control)
In order to embed a RDL file hosted on Report Server 2008 you need to follow these steps:

Drag ReportViewer control into your aspx page and set it for remote mode, like this:










Now go into your .cs page and copy this code under Page_Load event:
this.ReportViewer1.ServerReport.ReportServerUrl = new Uri(ConfigurationManager.AppSettings["reportUrl"]);
this.ReportViewer1.ServerReport.ReportPath = "/MyReport";
In order to find your report server URI you'll need to open Reporting Services Configuration Manager, go to Web Service URL tab and copy the url mentioned there. Because report server url can differ from server to server I did create a new entry in web.config (appSettings) named reportUrl to store this value.
Next step is to set the ReportPath property, in the Configuration Manager go to Report Manager URL tab and click on the link, the Report Manager will pop-up, if your desired report is in the root just replace "MyReport" with your report name in the code above.

Everything is now set but if you'll run the code you'll notice that ReportViewer will throw several exceptions like "The attempt to connect to the report server failed" or "The permissions granted to user 'NT AUTHORITY\NETWORK SERVICE' are insufficient for performing this operation."

Fix those security issues by adding these users to the SQLServerReportServerUser$ALEPH$MSRS10.SQL2008 like this:










I added the Administrator to this group because the ReportServer web site is running on my 2003 Server with anonymous access using the default account, on XP you'll have there the IUSR account, so you should add IUSR to the group as well.

We are almost done, there is one more thing to do, go to Report Manager, click on the desired report, click on the Properties tab and select from the left menu the Security section. Click on the New Role Assignment and add  NT AUTHORITY\NETWORK SERVICE with full rites, just check all the role boxes. You'll have to do this for every report that you want to embed using ReportViewer


Now if you'll run your page the report will show up nicely, if you need to supply your report with parameters from code you'll have to write in the Page_Load event something like this:
ReportParameter[] parameters = new ReportParameter[1];
parameters[0] = new ReportParameter("myParamName", "myValue");
this.ReportViewer1.ServerReport.SetParameters(parameters);
This method has been tested on XP Pro SP3, 2003 Server SP2 x86 & x64 with SQL Server 2008 Express and Enterprise x86 & x64. Note that both the ASP.NET app and the SQL Server must run on the same machine.

My Smartphone Wallet on smartphone-freeware.com

Download
the My Smartphone Wallet v1.0 free for Windows Mobile Smartphone

.mobi Mobile friendly download
Download My Smartphone Wallet v1.0 direct on your windows mobile smartphone

My Smartphone Wallet on Softpedia

My Smartphone Wallet Version 1.0 is on Softpedia at Handheld / Categories / Security / Password Managers