none
gfdgdf

    Question

  • Our SSRS 2005 report server is configured to use a custom security extension, it is working fine. We have no problem login into Report Manager (http://servername/reports) and report server (http://servername/reportserver). Now we are trying to use the Reportviewer control from VS 2005. 

    When requesting a report using the Web viewer control in our web application we get the following error message.

     

    • The request failed with the error message: -- <html><head><title>Object moved</title></head><body> <h2>Object moved to <a href="/ReportServer/logon.aspx?ReturnUrl=%2fReportServer%2fReportExecution2005.asmx">here</a>.</h2> </body></html> --.

    Here is the code in our web apps :

    Dim sReportServerURL As String = "http://Servername/ReportServer" ' Report server location

    ReportViewer1.EnableViewState = True

    ReportViewer1.ServerReport.ReportServerCredentials = New ReportViewerCredentials()

    ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote

    ReportViewer1.ServerReport.ReportServerUrl = New Uri(sReportServerURL)

    ReportViewer1.ServerReport.ReportPath = "/Reports/Reports"

    Dim Param(1) As ReportParameter

    Dim vlang As String

    Dim jobregion As String

    Param(0) = New ReportParameter("vlang", vlang)

    Param(1) = New ReportParameter("jobregion", jobregion)

    ReportViewer1.ServerReport.SetParameters(Param)

    ReportViewer1.ServerReport.Refresh()

    ====================================

    Here is our implementation of IReportServerCredentials

    Public Class ReportViewerCredentials Implements IReportServerCredentials

    Private _userName As String

    Private _password As String

    Private _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 Sub New()

    _userName = Nothing

    _password = Nothing

    _domain = Nothing

    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 Net.NetworkCredential(_userName, _password, _domain)

    'Return null for custom security extension

    Return Nothing

    End Get

    End Property

    Public Function GetFormsCredentials(ByRef authCookie 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 = password = authority = Nothing

    Dim cookie As HttpCookie = HttpContext.Current.Request.Cookies("sqlAuthCookie")

    If cookie Is Nothing Then

    HttpContext.Current.Response.Redirect("login.aspx")

    End If

    Dim netCookie As Cookie = New Cookie(cookie.Name, cookie.Value)

    If cookie.Domain Is Nothing Then

    netCookie.Domain = HttpContext.Current.Request.ServerVariables("SERVER_NAME").ToUpper

    End If

    netCookie.Expires = cookie.Expires

    netCookie.Path = cookie.Path

    netCookie.Secure = cookie.Secure

    authCookie = netCookie

    Return True

    End Function

    ===============================

    Is this the proper way to pass custom credentials to the report server when using the Web viewer control ? any help is appreciated

     

    chi

     

     

     

    Wednesday, April 04, 2007 5:18 PM