【解決方法】Windowsサーバー2019でのSSRS SQLサーバーレポートサーバーカスタムセキュリティ2019例外


こんにちは

Windows Server 2019 の SSRS(Sql Server Reporting Server) 2019 カスタム セキュリティ例外に関する問題に直面しています。

Vb.net Winforms ソース コードを使用してレポートを実行し、サーバー URL、ユーザー名、パスワード、DBName などの必要な詳細を含む WebRequest を SSRS サーバーに送信し、webResponse を使用して応答を返すには、ユーザーの認証 Cookie を取得する必要があります。

sqlAuthCookie が null であるためエラーが発生し、カスタム セキュリティ例外が有効になっていないためエラーが発生する

何か解決策/助けをいただければ幸いです

vb.netから送信し、SSRSサーバーから応答を取得するコードを添付しました。

VB.NET コード

Protected Overrides Function GetWebResponse(ByVal request As WebRequest) As WebResponse
        Dim response As WebResponse = MyBase.GetWebResponse(request)
        Dim cookieName As String = response.Headers("RSAuthenticationHeader")
        ' If the response contains an auth header, store the cookie
        If Not (cookieName Is Nothing) Then
            Dim webResponse As HttpWebResponse = CType(response, HttpWebResponse)
            Dim authCookie As Cookie = webResponse.Cookies(cookieName)
            ' If the auth cookie is null, throw an exception
            If authCookie Is Nothing Then
                Throw New Exception("Unable to generate report - the Reporting Services Custom Security Extension is expected to be enabled in XB")
            End If
            ' otherwise save it for this request
            Me.AuthCookie = authCookie
            ' and send it to the client
        End If
        Return response

    End Function

SSRS サービス コード

//adding new GetUserInfo method for IAuthenticationExtension2
       public void GetUserInfo(IRSRequestContext requestContext, out IIdentity userIdentity, out IntPtr userId)
       {
           userIdentity = null;
           if (requestContext.User != null)
           {
               userIdentity = requestContext.User;
           }

           // initialize a pointer to the current user id to zero
           userId = IntPtr.Zero;
       }

私が試したこと:

1. Web.Config ファイルは、詳細が正しく渡されたかどうかを確認しました

コメント

タイトルとURLをコピーしました