Hello
I am facing a problem with respect to SSRS(Sql Server Reporting Server) 2019 Custom security Exception in windows server 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
SSRS service code
public void GetUserInfo(IRSRequestContext requestContext, out IIdentity userIdentity, out IntPtr userId)
{
userIdentity = null;
if (requestContext.User != null)
{
userIdentity = requestContext.User;
}
userId = IntPtr.Zero;
}
What I have tried:
1.Web.Config files checked whether details has been passed correctly