System.Net.WebRequest

Added in .NET Framework 1.1



Create

link - docs.microsoft.com/en-us/dotnet/api/system.net.webrequest.create?view=net-6.0
The Create method initializes a new WebRequest.


Dim objWebRequest As System.Net.WebRequest 
objWebRequest = New System.Net.WebRequest.Create("url")

With objWebRequest
   .TimeOut =
   .MaximumAutomaticRedirections = 200
   .Credentials = New System.Net.NetworkCredential("userid", "password")
   .Method = "GET"
   .ContentType = "text/xml"
End With

Dim objResponse As System.Net.WebResponse
objResponse = objWebRequest.GetResponse()

Dim objStreamReader As System.IO.StreamReader
objStreamReader = objWebRequest.GetResponseStream

public static string HttpGet(string uri) 
{
    string content = null;
 
    HttpWebRequest request = (System.Net.HttpWebRequest)WebRequest.Create(uri);
 
    using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
    using (Stream stream = response.GetResponseStream())
    using (StreamReader sr = new StreamReader(stream))
    {
        content = sr.ReadToEnd();
    }
 
    return content;
}


Methods

Abort 
BeginGetRequestStream 
BeginGetResponse 
Create 
CreateDefault 
CreateHttp 
EndGetRequestStream 
EndGetResponse 
GetObjectData 
GetRequestStream 
GetRequestrStreamAsync 
GetResponse 
GetResponseAsync 
GetSystemWebProxy 
RegisterPrefix 

Properties

AuthenticationLevel 
CachePolicy 
ConnectionGroupName 
ContentLength 
ContentType 
Credentials 
DefaultCachePolicy 
DefaultWebProxy 
Headers 
ImpersonationLevel 
Method 
PreAuthenticate 
Proxy 
RequestUri 
Timeout 
UseDefaultCredentials 

© 2022 Better Solutions Limited. All Rights Reserved. © 2022 Better Solutions Limited TopPrevNext