SQL Server 2008 Reporting Services Custom Form Authentication Sample not working
-
Friday, November 14, 2008 8:35 PM
I am trying to get custom authentication to work,
because the default is simply not applicable to our environment,
and have tried two ways, but am stopped by errors out of my control:1. I got the Anonymous authentication in James Wu's blog to work,
and have been trying to use that as a starting point and tighten security, but,
whenever I try to get the user identity in the function GetUserInfo
in AuthenticationExtension.cs, using the following code:if (System.Web.HttpContext.Current != null && System.Web.HttpContext.Current.User.Identity != null)
{
userIdentity = System.Web.HttpContext.Current.User.Identity;
}I get error:
"Client found response content type of 'text/html; charset=utf-8', but expected 'text/xml'. "2. I downloaded the latest Forms authentication sample for 2008 from MSDN,
and converted it successfully to Visual Studio 2008,
compiled and followed instructions to configure Reporting Services for it.
I get the logon page when invoking /Reports, but,
when I enter a username and password and click Logon, I get the error message:
"An error occurred while attempting to get the ReportServer Url. Invalid namespace".
Taking a tip from some related blogs about this error,
I changed the reportingservices.mof file,
removing the "RS_" prefix from the instance name wherever namespace was mentioned,
but still get the same error.Can anyone help with a working sample for 2008?
All Replies
-
Tuesday, November 18, 2008 3:41 PMHere are the results of the debugging for the sample forms authentication:
1. Before starting,
copy the "Microsoft.Samples.ReportingServices.CustomSecurity.pdb" file,
which provides the debug symbols, corresponding to the dll file by the
same name to the "Report Server\bin" folder for the desired instance,
then restart that instance.
2. Start an IE session to access the report manager, and leave it at the form dialog without entering anything yet.
3.
In Visual Studio, go to "Debug, Attach to Process" and check the box to
show processes from all users, then find and attach the correct IE
session and the correct instance of Reporting Services, found by
hovering the cursor over the line to get a full display of the path to
the instance.
In AuthenticationUtiltities.cs, at the execution of "scope.Connect()", I
get the error "invalid namespace". That I don't understand, since the
namespace shown is the same as the namespace in "Report
Server\bin\reportingservices.mof", which I mofcomp'd after changing
"RS_MSRS10A" to "MSRS10A" throughout (the instance name is MSRS10A).
the fullWmiNamespace is "\\\\xxxxxxx\\root\Microsoft\\SqlServer\\ReportServer\\MSRS10A\\V10"
(where I've replaced the host name in this post by "xxxxxxx" for privacy reasons).
The snippet of code in AuthenticationUtilities.cs (unchanged from the Microsoft sample) is:
//Method to get the report server url using WMI
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage",
"CA2201
oNotRaiseReservedExceptionTypes"),
System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage",
"CA2201
oNotRaiseReservedExceptionTypes")]
internal static string GetReportServerUrl(string machineName, string instanceName)
{
string reportServerVirtualDirectory = String.Empty;
string fullWmiNamespace = @"\\" + machineName + string.Format(wmiNamespace, instanceName);
ManagementScope scope = null;
ConnectionOptions connOptions = new ConnectionOptions();
connOptions.Authentication = AuthenticationLevel.PacketPrivacy;
//Get management scope
try
{
scope = new ManagementScope(fullWmiNamespace, connOptions);
scope.Connect(); -
Tuesday, November 18, 2008 9:53 PM
I got the forms authentication sample working by commenting out the code trying to get the report server URL from WMI and simply hard coding it and returning that in the GetReportServerUrl method.
Apparently, WMI is not working on this server, or Reporting Services does not actually use any variation of the namespace name that I've seen in the Microsoft forums. If anyone has any ideas about that, I am curious and will be alerted by posts to this thread, otherwise, I'm happy for now.
-
Wednesday, November 19, 2008 5:33 PM
In another thread,Teo Lachev (Home page and blog: http://www.prologika.com/) said
"Take a look at the source code for chapter 19 in my book. There you'll find working WMI code for custom security."
I did look at Teo's source code, and noticed that Teo's AuthenticationUtilities.cs code prefixed the instance name by "RS_" when constructing the WMI namespace, whereas the Microsoft sample did not. So, instead of taking the "RS_" prefix out of the reportingservices.mof file, I put the "RS_" prefix into the AuthenticationUtilities.cs and it works. -
Thursday, July 08, 2010 7:58 AM
I got the forms authentication sample working by commenting out the code trying to get the report server URL from WMI and simply hard coding it and returning that in the GetReportServerUrl method.
Apparently, WMI is not working on this server, or Reporting Services does not actually use any variation of the namespace name that I've seen in the Microsoft forums. If anyone has any ideas about that, I am curious and will be alerted by posts to this thread, otherwise, I'm happy for now.
Hi, do you make sure your idea is correct? Why? It's really important to me. -
Wednesday, July 21, 2010 1:22 PM
Hi,
1.
Report server from SS 2005 provides an instance of class MSReportServer_Instance which has two properties ReportManagerUrl and ReportServerUrl and which are successfully used by Custom Authentication example.
But report server from SS 2008 provides an instance of class MSReportServer_Instance without those properties (at least they are absent on my PC :) ). Instead of them there is a method GetReportServerUrls which returns applications names and URLs. You can check details with the WMI Tools (downloadable from Microsoft web site).
2.
As someone has already mentioned You need to specify proper namespace name which can vary. On my PC it is: \\pcname\root\Microsoft\SqlServer\ReportServer\RS_SS2008\v10 where SS2008 is a SQL Server instance name. You can check the namespace name with the WMI Tools as well. Also You can check it with the WMI Control in the Services And Applications node of the Computer Management (on XP - on other systems it might be somewhere else). Open properties (an option in the context menu) and switch to Security page - there You can browse the namespaces tree.
-
Tuesday, November 08, 2011 1:28 PM
hi
in my requirement is ssrs report.that report in using asp.net
in button click event
but in mysystem is getting report.
but other systems not getting report.because i have all permission.
they people getting this error."
The permissions granted to user 'domain\username' are insufficient for performing this operation. (rsAccessDenied)
please tel me the solution
urgent please
indu

