WebRequest.PreAuthenticate Property indicates whether to pre-authenticate the request.
Imports System.IO
Imports System.Net
Imports System.Text
publicclass MainClass
Shared Sub Main()
Dim myWebRequest As WebRequest = WebRequest.Create("http://www.domain.com")
myWebRequest.PreAuthenticate = True
Dim UserName As String = Console.ReadLine()
Dim Password As String = Console.ReadLine()
Dim networkCredential As New NetworkCredential(UserName, Password)
myWebRequest.Credentials = networkCredential
Dim myWebResponse As WebResponse = myWebRequest.GetResponse()
End Sub
End Class