Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

This blog is for SQL SERVER developers. I am trying to publish the things that i face in my development career, so other developers can get help out of this BLOG.
Browse by Tags · View All
Tejas Shah 30
SQL SERVER 2005 11
SQL Server 10
SSIS 8
T-SQL 8
SQL Yoga 7
SSIS Task 7
SQLYoga 5
SQL Developer 5
DBA 5

Archive · View All
October 2012 5
October 2009 5
November 2012 3
December 2009 3
November 2009 3
September 2011 2
August 2010 2
April 2011 2
March 2010 2
September 2012 1

Tejas Shah's Blog

SSRS: Configure User Authentication with ReportCredentials

Apr 25 2011 2:02AM by Tejas Shah   

Many times I found that the Reporting service is configured to access as "Anonymous Access", so any user having URL can access reports from external world. Ideally it should be access by only users/application. For that SQL SERVER Reporting service should not be  accessed by "Anonymous Access". It also prevents Report server from unauthorized access.

NOTE: In shared hosting, Hosting provider provides username/password and only those users can get access to the reports for that specific user.

Today, I am going to explain to how to send user credentials from Report application, so Reporting service can authenticate user and allow to get reports. Only users having correct credentials can access the reports from the server. We are going to configure application to send credentials, so application can get access to the reports.

To configure application to get access reports from Shared hosting/Domain, we need to do following:

1. Get credentials from shared hosting/Domain controller to access the reports

2. Configure Application to Authenticate (.Net)

1. Get credentials

Whenever we need to deploy/access report from the Report Server, we should have following information:

    Report Server URL
  • UserName/Password to access the reports

This information will be provided by Shared hosting provider/Domain controller. Information like:

To check this information, Type Report URL in browser. It will ask for Username and password (if anonymous access is disabled). Enter given credentials, if Credentials are correct then Reporting service allow you to access the URL.

2. Configure Application to Authenticate (.Net)

As we get Basic information in step #1, now we need to build application that pass credentials to the Report server, so Report server authenticate the request and allow application to access the reports.

To authenticate request to Report server we need to implement IReportServerCredentials to send Report Credential to Report Server.

  • Create a class to implement IReportServerCredentials

SSRS ReportCredentials (2)

Please find VB code here:

Public Class ReportCredentials
    Implements Microsoft.Reporting.WebForms.IReportServerCredentials
 
    Private _userName As String, _password As String, _domain As String
 
    Public Sub New(ByVal userName As String, ByVal password As String, ByVal domain As String)
        _userName = userName
        _password = password
        _domain = domain
    End Sub
    Public ReadOnly Property ImpersonationUser() As System.Security.Principal.WindowsIdentity _
        Implements Microsoft.Reporting.WebForms.IReportServerCredentials.ImpersonationUser
        Get
            Return Nothing
        End Get
    End Property
 
    Public ReadOnly Property NetworkCredentials() As System.Net.ICredentials _
        Implements Microsoft.Reporting.WebForms.IReportServerCredentials.NetworkCredentials
        Get
            Return New System.Net.NetworkCredential(_userName, _password, _domain)
        End Get
    End Property
 
    Public Function GetFormsCredentials(ByRef authCoki As System.Net.Cookie, 
                   ByRef userName As String,   
                    ByRef password As String, _
                                        ByRef authority As String) As Boolean _
        Implements Microsoft.Reporting.WebForms.IReportServerCredentials.GetFormsCredentials
        userName = _userName
        password = _password
        authority = _domain
        authCoki = New System.Net.Cookie(".ASPXAUTH", ".ASPXAUTH", "/", "Domain")
 
        Return True
    End Function
 
End Class

Now we have created "ReportCredentials" class, now we need to use this class object to send credential info via Report Viewer Control as follows:

SSRS ReportCredentials 2

Please find VB code here:

Imports Microsoft.Reporting.WebForms
 
Partial Class Report
    Inherits System.Web.UI.Page
 
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) _ 
  Handles Me.Load
         
        If Not IsPostBack Then
            Dim ReportServerUrl As String = "https://<url>/ReportServer"
            Dim ReportDataSourceName As String = "/My Reports/"
            With Me.ReportViewer
                .ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote
                With .ServerReport
                    .ReportServerUrl = New Uri(ReportServerUrl)
                    .ReportPath = ReportDataSourceName + "ReportName"
                    .ReportServerCredentials = New _ 
         ReportCredentials("Domain", "UserName", "Password")
                    .Refresh()
                End With
            End With
            Page.Title = "Reports - " + Request.Params("Report")
            If Request.Params("HideOptions") = 1 Then
                ReportViewer.ShowParameterPrompts = False
            End If
        End If
    End Sub
End Class</url>

That's it, now you can access your reports deployed at Shared Hosting/Domain from application,
Report server allows to access if credentials are correct.

Let me know if you have any question/problem in deploying/accessing reports from Shared Hosting/Domain.


Republished from SQL Yoga [33 clicks].  Read the original version here [32134 clicks].

Tejas Shah
136 · 1% · 364
1
 
0
Lifesaver
 
0
Refreshed
 
0
Learned
 
0
Incorrect



Submit

1  Comments  

  • I have server parameter that takes whole connection string from web.config.

    ReportParameter rpDatasourceName = new ReportParameter("Server", ConfigurationManager.ConnectionStrings["ServerConnection"].ToString(), false);

    if i deployee report i will get following error. The current action cannot be completed. The user data source credentials do not meet the requirements to run this report or shared dataset. Either the user data source credentials are not stored in the report server database, or the user data source is configured not to require credentials but the unattended execution account is not specified. (rsInvalidDataSourceCredentialSetting)

    how i pass dynamic creditial in ssrs report with different connection string ????

    commented on Dec 21 2011 3:04AM
    Nilay Mistry
    2838 · 0% · 3

Your Comment


Sign Up or Login to post a comment.

"SSRS: Configure User Authentication with ReportCredentials" rated 5 out of 5 by 1 readers
SSRS: Configure User Authentication with ReportCredentials , 5.0 out of 5 based on 1 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]