Friday, January 15, 2010

Sql Server Reporting services and forms authentication – Part2 - How to implement?

Before continue this post, please read the post understanding the concept forms authentication in sql reports – Part1. The implementation of the process is so simple.

  • Microsoft team already given a sample application which has the forms authentication enabled.
  • They have written some code which has a security extension with login pages.
  • To understand it well or to implement just do this. Go here and download the sql server samples from Codeplex. http://www.codeplex.com/SqlServerSamples/Release/ProjectReleases.aspx?ReleaseId=4000
  • The file SqlServerSamples.msi contains all the example types for sql server.
  • Download the file and start installing them.
  • After installed the file successfully, go to the location where it installed [Usually if it is sql server 2005 then the location would be C:\Program Files\Microsoft SQL Server\90.] and the folder named "samples".
  • And in the samples folder we need to consider the sample "Samples\Reporting Services\Extension Samples\FormsAuthentication Sample".
  • This sample has all the code we needed.
  • Now, before proceed open the Readme file found in the location mentioned above.
  • This is the time we actually start the implementation. Please do as is mentioned in the readme file without anything missed.

The above process will take around half an hour to configure everything correct. And if we do everything correct, then you are able to see the report server running using forms authentication.

What to remember while implementing the process?

  • The connection string in the sample code. The sample code contains has the connection string as shown below.

    using (SqlConnection conn = new SqlConnection("Server=localhost;" +
                  "Integrated Security=SSPI;" + "database=UserAccounts"))

  • So be sure you installed the useraccounts database in the default instance of the sql server and the windows account you have logged in has access to it.

Now, you have everything installed and setup the forms authentication in sql server reports.

Hope you enjoyed the post. Please let me know your feedback and any questions if you have.

3 comments:

  1. Thank you, a good explanation in one place. I was travelling in circles finding out alternatives to the default sql report authentication and the reason for them. Now only just to implement. Thanks for sharing!

    ReplyDelete
  2. One point missed, the SQL Server Sample for Forms Authentication project are developed in VB. SQL 2005 Enterprise is only shipped with Visual Studio partner version to be used for Anaylsis, Reporting, and Integration SQL projects. This VS version does not include languages. Another license is required for an upgraded version of Visual Studio just for the samples that are SQL related. Need to find another blog\explanation how to setup the system for Forms Authentication without the use of the samples.

    ReplyDelete
  3. Im having a similar problem,
    when i try to open the solution with VS2005 I get error "The application for project C:\...\CustomSecurity.csproj is not installed. Make sure the application for the project type (.csproj) is installed."

    Do I need another VS version? or edition?

    ReplyDelete