Request sercued web pages (VB.NET)

    Public Function DownloadFileSecureURL(ByVal pstrURL As String, _
                                     
ByVal pstrFilename As String, _
                                     
ByVal pstrOutputPath As String, _
                                     
ByVal pstrUID As String, _
                                     
ByVal pstrPWD As String, _
                                     
ByRef pexcError As Exception) As Boolean
        
Dim wcWebClient As WebClient = New WebClient()

        
'Provide username/password to credentials and assign credentials to our WebClient object
        Dim ncCred As NetworkCredential = New NetworkCredential(pstrUID, pstrPWD)

        wcWebClient.Credentials 
= ncCred

        
Try
            wcWebClient.DownloadFile(pstrURL 
+ pstrFilename, pstrOutputPath + pstrFilename)
            
Return True
        
Catch ex As Exception
            pexcError 
= ex
            DisplayStatus(
"DownloadFileSecureURL : " + ex.ToString, 1)
            
Return False
        
End Try
    
End Function
posted @ 2005-11-10 23:21  dawave  阅读(274)  评论(0编辑  收藏  举报