Hi nauna,
Refer below sample.
Code
C#
protected void Page_Load(object sender, EventArgs e)
{
string url = "https://blackwebsite.s3.us-east-2.amazonaws.com/42431c75-9311-4730-960a-4052f2427ab9.png";
if (!System.IO.Directory.Exists(Server.MapPath("~/Files")))
{
System.IO.Directory.CreateDirectory(Server.MapPath("~/Files"));
}
using (System.Net.WebClient client = new System.Net.WebClient())
{
client.DownloadFile(new Uri(url), Server.MapPath("~/Files/42431c75-9311-4730-960a-4052f2427ab9.png"));
}
}
VB.Net
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
Dim url As String = "https://blackwebsite.s3.us-east-2.amazonaws.com/42431c75-9311-4730-960a-4052f2427ab9.png"
If Not IO.Directory.Exists(Server.MapPath("~/Files")) Then
IO.Directory.CreateDirectory(Server.MapPath("~/Files"))
End If
Using client As Net.WebClient = New Net.WebClient()
client.DownloadFile(New Uri(url), Server.MapPath("~/Files/42431c75-9311-4730-960a-4052f2427ab9.png"))
End Using
End Sub