Friday 15 January 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.

No comments:

Post a Comment