Quantcast
Channel: SQL Server Reporting Services
Viewing all articles
Browse latest Browse all 1418

SSRS FORMS AUTHENTICATION LOGIN ISSUE

$
0
0

I downloaded the sample for formsauthentication from MSDN and build the DLL's and deployed it on our server and made all necessary config changes as per the steps in document. I am good with registering the user and can see the username registered getting saved in the database. 

I am having issue while logging in with the user registered. It is throwing the below exception. Can you please review and help with this issue

Code snippet:

            

  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();

             //Get management class
             ManagementPath path = new ManagementPath("RS_serverinstance");
             ObjectGetOptions options = new ObjectGetOptions();
             ManagementClass serverClass = new ManagementClass(scope, path, options);
 serverClass.Get();
             if (serverClass == null)
             {
                 throw new Exception(string.Format(CultureInfo.InvariantCulture,
                   CustomSecurity.WMIClassError));
             }
             //Get instances
             ManagementObjectCollection instances = serverClass.GetInstances();

             foreach (ManagementObject instance in instances)
             {
                 instance.Get();

                 ManagementBaseObject outParams = (ManagementBaseObject)instance.InvokeMethod("GetReportServerUrls",
                    null, null);

                 string[] appNames = (string[])outParams["ApplicationName"];
                 string[] urls = (string[])outParams["URLs"];

                 for (int i = 0; i < appNames.Length; i++)
                 {
                     if (appNames[i] == "ReportServerWebService")
                         reportServerVirtualDirectory = urls[i];
                 }

                 if (reportServerVirtualDirectory == string.Empty)
                     throw new Exception(string.Format(CultureInfo.InvariantCulture,
                        CustomSecurity.MissingUrlReservation));
             }
         }
         catch (Exception ex)
         {
             throw new Exception(string.Format(CultureInfo.InvariantCulture,
                 CustomSecurity.RSUrlError + ex.Message + reportServerVirtualDirectory), ex);
         }
    
         return reportServerVirtualDirectory + rsAsmx;
      }

In the above code, it is failing at serverclass.get line

Exception Details

An error occured while attempting to get the ReportServer Url. Not found

System.Exception: An error occurred while attempting to get the ReportServer Url. Not found  ---> System.Management.ManagementException: Not found 
   at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode)
   at System.Management.ManagementObject.Initialize(Boolean getObject)
   at System.Management.ManagementBaseObject.get_wbemObject()
   at System.Management.ManagementBaseObject.get_ClassName()
   at System.Management.ManagementClass.GetInstances(EnumerationOptions options)
   at Microsoft.Samples.ReportingServices.CustomSecurity.AuthenticationUtilities.GetReportServerUrl(String machineName, String instanceName)
   --- End of inner exception stack trace ---
   at Microsoft.Samples.ReportingServices.CustomSecurity.AuthenticationUtilities.GetReportServerUrl(String machineName, String instanceName)
   at Microsoft.Samples.ReportingServices.CustomSecurity.UILogon.BtnLogon_Click(Object sender, EventArgs e)


Viewing all articles
Browse latest Browse all 1418

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>