title: ASP.NET ReportViewer with Forms Authentication
body: <p>We currently have a reporting server that uses Windows Authentication, and this works fine,</p>
  
  <p>The problem is that the web application we are using, uses forms authentication.</p>
  
  <p>When we connect the Report Viewer control to the service, we have tried this, which works:</p>
  
  <pre><code>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 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)
          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 = _userName
          password = _password
          authority = _domain
          Return Nothing
      End Function
  
  
  End Class
  </code></pre>
  
  <p>And we set the authentication using this:</p>
  
  <pre><code>ReportViewer1.ServerReport.ReportServerCredentials = New ReportViewerCredentials("username", "password", "")
  </code></pre>
  
  <p>Now this is the only example we have found, and we don't really want to store the password when the user logs into the app, in order to send it using the following example.</p>
  
  <p>Is there any way of using the forms authentication ticket to get access? Or any recommended way of doing this?</p>
  
  <p>Note that we cannot change the authentication of the actual report service.</p>
  
  <p>Thanks</p>