Problem with SSRS Forms Authentication
Hi All, I tried SSRS with Forms based authentication. I followed the below link http://praveenbattula.blogspot.com/2010/01/sql-server-reporting-services-and-forms_15.html I am getting null value at the below code line ...[This entire code has been downloaded from the link http://www.codeplex.com/SqlServerSamples/Release/ProjectReleases.aspx?ReleaseId=4000 ] string cookieName = response.Headers["RSAuthenticationHeader"]; In "Headers" there is no key as RSAuthenticationHeader and returning null. Before debugging all this code, done like this.... As per "Readme_FormsAuthenication.htm " file, 1)changed all the config keys of "Report Server and Report Manager" of installed paths. 2)Pasted the .aspx pages in the corresponding "Report Server and Report Manager" folders. 3)Taken test application and added the reference "Microsoft.Samples.ReportingServices.CustomSecurity.dll" to it. 4)Restored "UserAccounts" DB locally. 5)While debugging with "Logon" button, raised the problem at the mentioned line of code[mentioned above]. It has worked out for "Register User" button. Please clarify me ASAP... i am not getting any solution for this. or can any body tell me is there any alternate solution for the Forms Authentication for SSRS
August 7th, 2010 4:18pm

Hi raviprakash_p, The issue you described that the HTTPContext.Current return null is a known issue in the Custom Forms Authentication in SQL Server Reporting Services 2008 R2. It had been submitted in the Connect site, and one person from the SQL Server Reporting Services product team has provided a workaround: https://connect.microsoft.com/SQLServer/feedback/details/533197/sql-server-2008-r2-november-ctp-forms-authentication-not-working-in-ssrs?wa=wsignin1.0 As bgertsberg filled in the feedback, we need to two more codes to the workaround like this: return IsServiceObjectRequest(context, ReportServerServiceObject2005) || IsServiceObjectRequest(context, ReportServerServiceObject2006) || IsServiceObjectRequest(context, ReportServerServiceObject2010) || IsServiceObjectRequest(context, ReportServerExecutionObject2005); private const string ReportServerServiceObject2005 = "/ReportService2005.asmx"; private const string ReportServerServiceObject2006 = "/ReportService2006.asmx"; private const string ReportServerServiceObject2006 = "/ReportService2010.asmx"; private const string ReportServerExecutionObject2005 = "/ReportExecution2005.asmx"; Please note the "Bold" code in the above sample. If there is anything unclear, please feel free to ask. Thanks, Jin Chen Jin Chen - MSFT
Free Windows Admin Tool Kit Click here and download it now
August 9th, 2010 10:44am

Hi Jin, Thank you for the reply.... I have built a project by following the link given by you... I am not getting one thing that .. do i need to call this DLL in any other application[which will ask user name & password] or changing the config files as you mentioned is enough to take care about Forms authentication? Actually i followed the below steps initially with the HTML file of [ C:\Program Files\Microsoft SQL Server\90\Samples\Reporting Services\Extension Samples\FormsAuthentication Sample\Readme_FormsAuthenication.html ] STEP 1 : - Created "Strong Named Key" for the "Forms Authentication Sample" of "C:\Program Files\Microsoft SQL Server\90\Samples\Reporting Services\Extension Samples\FormsAuthentication Sample\cs\ " and built the application. STEP 2 : - I have changed the config files [ rsmgrpolicy.config, RSWebApplication.config & Web.config of "C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportManager " folder] and changed [ rsreportserver.config, rssrvpolicy.config & web.config of "C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer " folder] STEP 3 : - Configured 'Anonymous Authentication' of IIS [done it for "ReportServer" & "Reports" virtual directories] STEP 4 : - Restored "UserAccounts" data base locally... STEP 5 : - Taken one sample application and added the DLL[Microsoft.Samples.ReportingServices.CustomSecurity.dll] ....Added .aspx page for this sample application and called LogOn functionality which contains below action of code ReportServerProxy server = new ReportServerProxy(); // Get the server URL from the Report Manager configuration file server.Url = AuthenticationUtilities.GetReportServerUrl("Sys Name"); server.LogonUser(TxtUser.Text, TxtPwd.Text, null); passwordVerified = true; Here it is raising the error at the line ..... string cookieName = response.Headers["RSAuthenticationHeader"]; --> Which is of "protected override WebResponse GetWebResponse(WebRequest request)" method. Since "Headers" does not contain a key as "RSAuthenticationHeader" ....... & skipping the condition if (cookieName != null) --> since it is null..... Finally ... return response; --> returns the content type in 'text/html'--> throwing the exception as expecting the content type of 'text/XML' format.... I have been strucked at this step ... and i am unable to come to know what could be the next step.... This code is working for "Register User" button perfectly. But when i logging in with that registered user, raised the exception... I am using SQL Server 2005 Please help me out in this issue.... Regards Ravi
August 9th, 2010 3:12pm

Hi Ravi, Sorry, I have misunderstood. The link I posted is used for SQL Server Reporting Services 2008 R2. However, in this case, you are using SQL Server Reporting Services 2005. Please ignore the link I posted before. I am sure the Forms Authentication works in SQL Server Reporting Services 2005. Based on my experience, this issue should be caused by incorrect configuration. Could you please post the configuration files? This will help us to troubleshoot the issue. Thanks, Jin ChenJin Chen - MSFT
Free Windows Admin Tool Kit Click here and download it now
August 10th, 2010 4:40am

Hi Jin, I have changed the configuration files as it mentioned in "Readme...HTML file" mentioned the path in previous post. . . . . I can't attach those files here ..... Sooo let me describe you how i changed those config files.... rsreportserver.config : - Path -- C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer Changed -- <UrlRoot>http://server name/reportserver</UrlRoot> [ Given my SQL Server name in this URL] and < Security > < Extension Name = " Forms " Type = " Microsoft.Samples.ReportingServices.CustomSecurity.Authorization, Microsoft.Samples.ReportingServices.CustomSecurity " > < Configuration > < AdminConfiguration > < UserName > username</ UserName > </ AdminConfiguration > </ Configuration > </ Extension > </ Security > < Security > <!--<Extension Name="Windows" Type="Microsoft.ReportingServices.Authorization.WindowsAuthorization, Microsoft.ReportingServices.Authorization"/>--> <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="Windows" Type="Microsoft.ReportingServices.Authentication.WindowsAuthentication, Microsoft.ReportingServices.Authorization"/>--> <Extension Name="Forms" Type="Microsoft.Samples.ReportingServices.CustomSecurity.AuthenticationExtension, Microsoft.Samples.ReportingServices.CustomSecurity" /> </ Authentication > <!--Ended here--> RSWebApplication.config : - Path -- C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportManager Changed -- < UI > < CustomAuthenticationUI > < loginUrl > /Pages/UILogon.aspx</ loginUrl > < UseSSL > False</ UseSSL > </ CustomAuthenticationUI > < ReportServerUrl > http://Server name/ReportServer</ ReportServerUrl > </ UI > < br /> Note:- Here i pasted the "UILogon.aspx" page in 'Pages' folder of ...Installed Path/Reporting Services\ReportManager\Pages ... folder RSSrvPolicy.config : - Path -- C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer Changed -- < CodeGroup class = " UnionCodeGroup " version = " 1 " PermissionSetName = " FullTrust " > < IMembershipCondition class = " UrlMembershipCondition " version = " 1 " Url = " $CodeGen$/* " /> </ CodeGroup > < 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\MSSQL.3\Reporting Services\ReportServer\bin\Microsoft.Samples.ReportingServices.CustomSecurity.dll " /> </ CodeGroup > < br /> Note:- Here i pasted the DLL [Microsoft.Samples.ReportingServices.CustomSecurity.dll] in the URL node... rsmgrpolicy.config : - Path -- C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportManager Changed -- < CodeGroup class = " FirstMatchCodeGroup " version = " 1 " PermissionSetName = " FullTrust " Description = " This code group grants MyComputer code Execution permission. " > < IMembershipCondition class = " ZoneMembershipCondition " version = " 1 " Zone = " MyComputer " /> web.config : - Path -- C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer Changed -- < identity impersonate = " false " /> and < authentication mode = " Forms " > < forms loginUrl = " logon.aspx " name = " sqlAuthCookie " slidingExpiration = " true " timeout = " 60 " path = " / " > </ forms > </ authentication > < authorization > < deny users = " ? " /> </ authorization > < br /> Note:- Here i did not get where we have used this "sqlAuthCookie" ['name'] in the code behind Web.config : - Path -- C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportManager Changed -- < identity impersonate = " false " /> Thats all Jin....what i changed in the config files .... I am very new to SSRS .. I am not getting What & Where ... the effect of these config file values at runtime ... Waiting for your reply .... Thanks ... Ravi
August 10th, 2010 10:29am

Hi Ravi, All you done looks fine. Currently, could you please check if there is any error in the SQL Server Reporting Services error logs? Thanks, Jin ChenJin Chen - MSFT
Free Windows Admin Tool Kit Click here and download it now
August 11th, 2010 9:33am

Hi Jin, Check this log information ... I don't know whether it is going to help you or not .. but i went to "C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\LogFiles\" path --> opened "ReportServerWebApp__08_09_2010_11_59_07" log file and --> pasted below..... <Header> <Product>Microsoft SQL Server Reporting Services Version 9.00.1399.00</Product> <Locale>en-US</Locale> <TimeZone>India Standard Time</TimeZone> <Path>C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\LogFiles\ReportServerWebApp__08_09_2010_11_59_07.log</Path> <SystemName>NTC-IT2</SystemName> <OSName>Microsoft Windows NT 5.1.2600 Service Pack 2</OSName> <OSVersion>5.1.2600.131072</OSVersion> </Header> aspnet_wp!library!1!8/9/2010-11:59:07:: i INFO: Initializing ReportBuilderTrustLevel to '0' as specified in Configuration file. aspnet_wp!library!1!8/9/2010-11:59:07:: i INFO: Initializing MaxActiveReqForOneUser to '20' requests(s) as specified in Configuration file. aspnet_wp!library!1!8/9/2010-11:59:07:: i INFO: Initializing MaxScheduleWait to default value of '1' second(s) because it was not specified in Configuration file. aspnet_wp!library!1!8/9/2010-11:59:07:: i INFO: Initializing DatabaseQueryTimeout to default value of '30' second(s) because it was not specified in Configuration file. aspnet_wp!library!1!8/9/2010-11:59:07:: i INFO: Initializing ProcessRecycleOptions to default value of '0' because it was not specified in Configuration file. aspnet_wp!library!1!8/9/2010-11:59:07:: i INFO: Initializing RunningRequestsScavengerCycle to default value of '30' second(s) because it was not specified in Configuration file. aspnet_wp!library!1!8/9/2010-11:59:07:: i INFO: Initializing RunningRequestsDbCycle to default value of '30' second(s) because it was not specified in Configuration file. aspnet_wp!library!1!8/9/2010-11:59:07:: i INFO: Initializing RunningRequestsAge to default value of '30' second(s) because it was not specified in Configuration file. aspnet_wp!library!1!8/9/2010-11:59:07:: i INFO: Initializing CleanupCycleMinutes to default value of '10' minute(s) because it was not specified in Configuration file. aspnet_wp!library!1!8/9/2010-11:59:07:: i INFO: Initializing DailyCleanupMinuteOfDay to default value of '120' minutes since midnight because it was not specified in Configuration file. aspnet_wp!library!1!8/9/2010-11:59:07:: i INFO: Initializing WatsonFlags to default value of '1064' because it was not specified in Configuration file. aspnet_wp!library!1!8/9/2010-11:59:07:: i INFO: Initializing WatsonDumpOnExceptions to default value of 'Microsoft.ReportingServices.Diagnostics.Utilities.InternalCatalogException,Microsoft.ReportingServices.Modeling.InternalModelingException' because it was not specified in Configuration file. aspnet_wp!library!1!8/9/2010-11:59:07:: i INFO: Initializing WatsonDumpExcludeIfContainsExceptions to default value of 'System.Data.SqlClient.SqlException,System.Threading.ThreadAbortException' because it was not specified in Configuration file. aspnet_wp!library!1!8/9/2010-11:59:07:: i INFO: Initializing SecureConnectionLevel to default value of '1' because it was not specified in Configuration file. aspnet_wp!library!1!8/9/2010-11:59:07:: i INFO: Initializing DisplayErrorLink to 'True' as specified in Configuration file. aspnet_wp!library!1!8/9/2010-11:59:07:: i INFO: Initializing WebServiceUseFileShareStorage to default value of 'False' because it was not specified in Configuration file. aspnet_wp!ui!1!8/9/2010-11:59:07:: Unhandled exception: System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. at System.Reflection.Assembly._GetType(String name, Boolean throwOnError, Boolean ignoreCase) at System.Reflection.Assembly.GetType(String name, Boolean throwOnError) at System.Web.Compilation.BuildResultCompiledType.GetPreservedAttributes(PreservationFileReader pfr) at System.Web.Compilation.PreservationFileReader.ReadFileInternal(VirtualPath virtualPath, String preservationFile, Int64 hashCode) at System.Web.Compilation.PreservationFileReader.ReadBuildResultFromFile(VirtualPath virtualPath, String preservationFile, Int64 hashCode) at System.Web.Compilation.DiskBuildResultCache.GetBuildResult(String cacheKey, VirtualPath virtualPath, Int64 hashCode) at System.Web.Compilation.BuildManager.GetBuildResultFromCacheInternal(String cacheKey, Boolean keyFromVPP, VirtualPath virtualPath, Int64 hashCode) at System.Web.Compilation.BuildManager.GetVPathBuildResultFromCacheInternal(VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean noAssert) at System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp, Boolean noAssert) at System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) at System.Web.UI.PageHandlerFactory.System.Web.IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) at System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) at System.Web.HttpApplication.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) The action that failed was: InheritanceDemand The type of the first permission that failed was: System.Web.AspNetHostingPermission The first permission that failed was: <IPermission class="System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Level="Minimal"/> The demand was for: <PermissionSet class="System.Security.PermissionSet" version="1"> <IPermission class="System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Level="Minimal"/> </PermissionSet> The granted set of the failing assembly was: <PermissionSet class="System.Security.PermissionSet" version="1"> <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Execution"/> <IPermission class="System.Security.Permissions.StrongNameIdentityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" PublicKeyBlob="0024000004800000940000000602000000240000525341310004000001000100C3BBE36DD5CDC8B5F58909D6905C66A1E040763CEB024E45197D29FE6ADE8036108C035D063FB1262B9711B68CEBC503BA24522231810410C773184A6AE79207B9E72A11223C9CF0B5F9E7A7B9924158F83BDF9DD60B7DD05C5AF3014210D330329041C6F1D7AC6FA7E35DCAB9F2AE45104DA668D6E6915B689608A433B3A6A0" Name="Microsoft.Samples.ReportingServices.CustomSecurity" AssemblyVersion="1.0.3868.27278"/> <IPermission class="System.Security.Permissions.UrlIdentityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Url="file:///C:/Program Files/Microsoft SQL Server/MSSQL.3/Reporting Services/ReportManager/bin/Microsoft.Samples.ReportingServices.CustomSecurity.DLL"/> <IPermission class="System.Security.Permissions.ZoneIdentityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Zone="MyComputer"/> </PermissionSet> The assembly or AppDomain that failed was: Microsoft.Samples.ReportingServices.CustomSecurity, Version=1.0.3868.27278, Culture=neutral, PublicKeyToken=a5682307042bdbe3 The Zone of the assembly that failed was: MyComputer The Url of the assembly that failed was: file:///C:/Program Files/Microsoft SQL Server/MSSQL.3/Reporting Services/ReportManager/bin/Microsoft.Samples.ReportingServices.CustomSecurity.DLL Please let me know .. if it is unclear .. or tell me where i have to check the error log events properly Regards Ravi
August 11th, 2010 10:20am

Was this problem ever resolved because I am having the exact same issue
Free Windows Admin Tool Kit Click here and download it now
October 12th, 2010 10:38pm

Hi Ravi, If you are using reporting services 2008 R2, please apply cumulative update 3 (http://support.microsoft.com/kb/2261464). Issue related to forms based authentication with respect to reporting services 2008 r2 has been fixed in CU3. the following link describes the same(http://support.microsoft.com/kb/2261464). Thanks singhguru
October 13th, 2010 2:52am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics