I am facing a problem with respect to SSRS(Sql Server Reporting Server) 2019 Custom security Exception in windows server 2019.
SSRS report works fine from winforms vb.net code in previous version of SQL Server (2016, 2014 and 2012) but not in 2019.
Running report using Vb.net Winforms source code and sending WebRequest to SSRS server with necessary details like server url,username ,password, DBName etc, with response back using webResponse need to get authentication cookie for the User
Getting error as sqlAuthCookie is null, also getting an error as Custom security exception is not enabled
Anything solution/help would be highly appreciated
Attached the Piece of code which sending from vb.net and getting response from SSRS server.
VB.NET Code
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
//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;
}