Passing User Credentials to SSRS

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rgp34
    New Member
    • Jun 2012
    • 1

    Passing User Credentials to SSRS

    Hi, I am trying to check if an image file exists. If it does exist then use it, otherwise, use a default image. I am trying to pass integrated windows login credentials to get a response but I always return false. It seems to not like the credentials. Does anyone have input here? Thanks in advance!

    Here is my code:

    PS - All this code is done inside the Custom Code of SSRS

    Code:
    Function IsValid(ByVal Url As String) As Boolean
            Dim URLRes As Net.FileWebResponse
            Dim URLReq As Net.FileWebRequest
            Dim myURI As New Uri("file://www.example.com/" & Url & ".jpg")
            Try
    	URLReq = Net.FileWebRequest.Create(myURI)
    	URLReq.Credentials = Net.CredentialCache.DefaultCredentials
    	URLRes = URLReq.GetResponse()	
    	Return True
            Catch ex As Exception
                Return False
            End Try
        End Function
    Last edited by PsychoCoder; Jun 7 '12, 03:00 AM. Reason: Code tags added :)
Working...