System.Net.WebClient: Unterschied zwischen den Versionen

Aus Wiki-WebPerfect
Wechseln zu: Navigation, Suche
(Die Seite wurde neu angelegt: „== Download from URL with "System.NET.WebClient" == <source lang="powershell"> $webclient = new-object System.Net.WebClient #[System.Net.ServicePointManager]::…“)
 
 
Zeile 2: Zeile 2:
 
<source lang="powershell">
 
<source lang="powershell">
 
$webclient = new-object System.Net.WebClient
 
$webclient = new-object System.Net.WebClient
#[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true} #If certificate Selfsigned
+
#If certificate Selfsigned
$webclient.Credentials = new-object System.Net.NetworkCredential($username, $password)
+
    #[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}  
 +
#If WebRequest need a User authentication
 +
    #$webclient.Credentials = new-object System.Net.NetworkCredential($username, $password)
 
$webpage = $webclient.DownloadString("<URL>")
 
$webpage = $webclient.DownloadString("<URL>")
 
</source>
 
</source>

Aktuelle Version vom 28. Juni 2018, 15:40 Uhr

Download from URL with "System.NET.WebClient"

$webclient = new-object System.Net.WebClient
#If certificate Selfsigned
    #[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true} 
#If WebRequest need a User authentication
    #$webclient.Credentials = new-object System.Net.NetworkCredential($username, $password)
$webpage = $webclient.DownloadString("<URL>")