Hi
On MemoryStream line i am getting error.
Invalid System operation exception
https://nimubs-assets.s3.amazonaws.com/manifest/20230113163940-91.pdf
string s = pdf;
int idx = s.LastIndexOf('/');
string firstPart ="";
string secondPart ="";
if (idx != -1)
{
firstPart = s.Substring(0, idx); // htts://nimubs-assets.s3.amazonaws.com/manifest
secondPart = s.Substring(idx + 1); // 20221227113803-73.pdf
}
//var pdf0 = DateTime.Now.ToString("yyyyMMddHHmm") + "_" + secondPart;
var pdf0 = secondPart;
var request0 = new RestRequest(secondPart, Method.GET);
var client0 = new RestClient(firstPart);
var content = client0.DownloadData(request0);
string FolderPath = "~/App_Data/";
string FilePath = Server.MapPath(FolderPath);
MemoryStream ms = new MemoryStream(content);
FileStream file = new FileStream(@FilePath + pdf0, FileMode.Create, FileAccess.Write);
ms.WriteTo(file);
file.Close();
ms.Close();