After the sample is compiled, you must copy the DLLs and the ASPX pages to the appropriate subdirectories for your Report Server installation.

To deploy the sample
-
Copy Microsoft.Samples.ReportingServices.CustomSecurity.dll and Microsoft.Samples.ReportingServices.CustomSecurity.pdb to the <install>\ReportServer\bin directory.
-
Copy Microsoft.Samples.ReportingServices.CustomSecurity.dll and Microsoft.Samples.ReportingServices.CustomSecurity.pdb to the <install>\ReportManager\bin directory.
-
Copy the Logon.aspx page to the <install>\ReportServer directory.
-
Copy the UILogon.aspx page to the <install>\ReportManager\Pages directory.
-
Copy Microsoft.Samples.ReportingServices.CustomSecurity.dll and Microsoft.Samples.ReportingServices.CustomSecurity.pdb to the <install>\ReportServer\bin directory.
-
Copy Microsoft.Samples.ReportingServices.CustomSecurity.dll and Microsoft.Samples.ReportingServices.CustomSecurity.pdb to the <install>\ReportManager\bin directory.
-
Copy the Logon.aspx page to the <install>\ReportServer directory.
-
Copy the UILogon.aspx page to the <install>\ReportManager\Pages directory.
After the assembly and logon pages are copied to the server, you need to make some modifications to the Report Server configuration file.
Important: |
|---|
|
Make backup copies of all of your configuration files before making any changes.
|

To modify the RSReportServer.config file
-
Open the RSReportServer.config file with Visual Studio 2005 or a simple text editor such as Notepad. RSReportServer.config is located in the <install>\ReportServer directory.
-
Locate the <AuthenticationTypes> element and modify the settings as follows:
<Authentication>
<AuthenticationTypes>
<Custom/>
</AuthenticationTypes>
<EnableAuthPersistence>true</EnableAuthPersistence>
</Authentication>
-
Locate the <Security> and <Authentication> elements, within the <Extensions> element, and modify the settings as follows:
<Security>
<Extension Name="Forms"
Type="Microsoft.Samples.ReportingServices.CustomSecurity.Authorization,
Microsoft.Samples.ReportingServices.CustomSecurity" >
<Configuration>
<AdminConfiguration>
<UserName>username</UserName>
</AdminConfiguration>
</Configuration>
</Extension>
</Security>
<Authentication>
<Extension Name="Forms"
Type="Microsoft.Samples.ReportingServices.CustomSecurity.AuthenticationExtension,
Microsoft.Samples.ReportingServices.CustomSecurity" />
</Authentication>
For more information regarding .NET Framework security and Reporting Services, see Secure Development (Reporting Services).
-
Locate the <UI> element and update it as follows:
<UI>
<CustomAuthenticationUI>
<loginUrl>/Pages/UILogon.aspx</loginUrl>
<UseSSL>True</UseSSL>
</CustomAuthenticationUI>
<ReportServerUrl>http://<server>/ReportServer</ReportServerUrl>
</UI>
Note: |
|---|
|
If you are running the sample security extension in a development environment that does not have a Secure Sockets Layer (SSL) certificate installed, you must change the value of the <UseSSL> element to False in the previous configuration entry. We recommend that you always use SSL when combining Reporting Services with Forms Authentication.
|
-
Open the RSReportServer.config file with Visual Studio 2005 or a simple text editor such as Notepad. RSReportServer.config is located in the <install>\ReportServer directory.
-
Locate the <AuthenticationTypes> element and modify the settings as follows:
<Authentication>
<AuthenticationTypes>
<Custom/>
</AuthenticationTypes>
<EnableAuthPersistence>true</EnableAuthPersistence>
</Authentication>
-
Locate the <Security> and <Authentication> elements, within the <Extensions> element, and modify the settings as follows:
<Security>
<Extension Name="Forms"
Type="Microsoft.Samples.ReportingServices.CustomSecurity.Authorization,
Microsoft.Samples.ReportingServices.CustomSecurity" >
<Configuration>
<AdminConfiguration>
<UserName>username</UserName>
</AdminConfiguration>
</Configuration>
</Extension>
</Security>
<Authentication>
<Extension Name="Forms"
Type="Microsoft.Samples.ReportingServices.CustomSecurity.AuthenticationExtension,
Microsoft.Samples.ReportingServices.CustomSecurity" />
</Authentication>
For more information regarding .NET Framework security and Reporting Services, see Secure Development (Reporting Services).
-
Locate the <UI> element and update it as follows:
<UI>
<CustomAuthenticationUI>
<loginUrl>/Pages/UILogon.aspx</loginUrl>
<UseSSL>True</UseSSL>
</CustomAuthenticationUI>
<ReportServerUrl>http://<server>/ReportServer</ReportServerUrl>
</UI>
Note: |
|---|
|
If you are running the sample security extension in a development environment that does not have a Secure Sockets Layer (SSL) certificate installed, you must change the value of the <UseSSL> element to False in the previous configuration entry. We recommend that you always use SSL when combining Reporting Services with Forms Authentication.
|
You will need to add a code group for your custom security extension that grants FullTrust permission for your extension. You do this by adding the code group to the RSSrvPolicy.config file.

To modify the RSSrvPolicy.config file
-
Open the RSSrvPolicy.config file located in the <install>\ReportServer directory.
-
Add the following <CodeGroup> element after the existing code group in the security policy file that has a URL membership of $CodeGen as indicated below and then add an entry as follows to RSSrvPolicy.config:
<CodeGroup
class="UnionCodeGroup"
version="1"
Name="SecurityExtensionCodeGroup"
Description="Code group for the sample security extension"
PermissionSetName="FullTrust">
<IMembershipCondition
class="UrlMembershipCondition"
version="1"
Url="C:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportServer\bin\Microsoft.Samples.ReportingServices.CustomSecurity.dll"
/>
</CodeGroup>
Note: |
|---|
|
For simplicity, the Forms Authentication Sample is weak-named and requires a simple URL membership entry in the security policy files. In your production security extension implementation, you should create strong-named assemblies and use the strong name membership condition when adding security policies for your assembly. For more information about strong-named assemblies, see the Creating and Using Strong-Named Assemblies topic on MSDN.
|
-
Open the RSSrvPolicy.config file located in the <install>\ReportServer directory.
-
Add the following <CodeGroup> element after the existing code group in the security policy file that has a URL membership of $CodeGen as indicated below and then add an entry as follows to RSSrvPolicy.config:
<CodeGroup
class="UnionCodeGroup"
version="1"
Name="SecurityExtensionCodeGroup"
Description="Code group for the sample security extension"
PermissionSetName="FullTrust">
<IMembershipCondition
class="UrlMembershipCondition"
version="1"
Url="C:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportServer\bin\Microsoft.Samples.ReportingServices.CustomSecurity.dll"
/>
</CodeGroup>
Note: |
|---|
|
For simplicity, the Forms Authentication Sample is weak-named and requires a simple URL membership entry in the security policy files. In your production security extension implementation, you should create strong-named assemblies and use the strong name membership condition when adding security policies for your assembly. For more information about strong-named assemblies, see the Creating and Using Strong-Named Assemblies topic on MSDN.
|
Next, you will need to increase the permissions for the "My Computer" code group in the Report Manager policy file.

To modify the RSMgrPolicy.config file
-
Open the Report Manager policy file, RSMgrPolicy.config, located in the <install>\ReportManager directory.
-
Locate the following code group in RSMgrPolicy.config and change the PermissionSetName attribute from Execution to FullTrust as follows:
<CodeGroup
class="FirstMatchCodeGroup"
version="1"
PermissionSetName="FullTrust"
Description="This code group grants MyComputer code Execution
permission. ">
<IMembershipCondition
class="ZoneMembershipCondition"
version="1"
Zone="MyComputer" />
-
Open the Report Manager policy file, RSMgrPolicy.config, located in the <install>\ReportManager directory.
-
Locate the following code group in RSMgrPolicy.config and change the PermissionSetName attribute from Execution to FullTrust as follows:
<CodeGroup
class="FirstMatchCodeGroup"
version="1"
PermissionSetName="FullTrust"
Description="This code group grants MyComputer code Execution
permission. ">
<IMembershipCondition
class="ZoneMembershipCondition"
version="1"
Zone="MyComputer" />
To use Forms Authentication, you need to modify the Web.config files for Report Manager and Report Server.

To modify the Web.config file for Report Server
-
Open the Web.config file in a text editor. By default, the file is located in the <install>\ReportServer directory.
-
Locate the <identity> element and set the Impersonate attribute to false.
<identity impersonate="false" />
-
Locate the <authentication> element and change the Mode attribute to Forms.
-
Add the following <forms> element as a child of the <authentication> element and set the loginUrl, name, timeout, and path attributes as follows:
<authentication mode="Forms">
<forms loginUrl="logon.aspx" name="sqlAuthCookie" timeout="60"
path="/"></forms>
</authentication>
-
Add the following <authorization> element directly after the <authentication> element.
<authorization>
<deny users="?" />
</authorization>
This will deny unauthenticated users the right to access the report server. The previously established loginUrl attribute of the <authentication> element will redirect unauthenticated requests to the Logon.aspx page.
-
Open the Web.config file in a text editor. By default, the file is located in the <install>\ReportServer directory.
-
Locate the <identity> element and set the Impersonate attribute to false.
<identity impersonate="false" />
-
Locate the <authentication> element and change the Mode attribute to Forms.
-
Add the following <forms> element as a child of the <authentication> element and set the loginUrl, name, timeout, and path attributes as follows:
<authentication mode="Forms">
<forms loginUrl="logon.aspx" name="sqlAuthCookie" timeout="60"
path="/"></forms>
</authentication>
-
Add the following <authorization> element directly after the <authentication> element.
<authorization>
<deny users="?" />
</authorization>
This will deny unauthenticated users the right to access the report server. The previously established loginUrl attribute of the <authentication> element will redirect unauthenticated requests to the Logon.aspx page.

To modify the Web.config file for Report Manager
-
Open the Web.config for Report Manager. It is located in the <install>\ReportManager directory.
-
Disable impersonation by locating the section <identity impersonate= "true" /> and changing it to the following: <identity impersonate="false" />.
-
Add the following keys to the <appSettings> element.
<add key="ReportServer" value="<Server Name>"/>
<add key="ReportServerInstance" value="<Instance Name>"/>
-
Change the <Server Name> value to the name of the report server and the <Instance Name> value to the name of the instance the report server is associated with.
-
Open the Web.config for Report Manager. It is located in the <install>\ReportManager directory.
-
Disable impersonation by locating the section <identity impersonate= "true" /> and changing it to the following: <identity impersonate="false" />.
-
Add the following keys to the <appSettings> element.
<add key="ReportServer" value="<Server Name>"/>
<add key="ReportServerInstance" value="<Instance Name>"/>
-
Change the <Server Name> value to the name of the report server and the <Instance Name> value to the name of the instance the report server is associated with.