Mr Muddassar,
I have an issue to save the pdf file from ASP.net Page to server --> Application Folder.
I have tried; file could not save in server folder.
Please advise me
Maideen
Private Async Function Downloadbill() As Task
      Dim client As New HttpClient()
      Dim request As New HttpRequestMessage(HttpMethod.Post, "https://app.lixxxxxx.com/Savebill")
      request.Headers.Add("Authorization", "XXXXXXXXXxxxxx")
      Dim payload As String = "{ " & vbCrLf &
          " ""BillType"" : """ & "Parent Invoice" & """," & vbCrLf &
          " ""Bills"" : """ & Me.txtEncode.Text & """," & vbCrLf &
          " ""PrintOption"" : """ & "WB" & """ " & vbCrLf &
          "}"
      Dim content As New StringContent(payload, Nothing, "application/json")
      request.Content = content
      Dim response As HttpResponseMessage = Await client.SendAsync(request)
      response.EnsureSuccessStatusCode()
      ' Add the Content-Type header to the response
      response.Content.Headers.ContentType = New MediaTypeHeaderValue("application/pdf")
      ' Read the response content as a byte array
      Dim responseBytes As Byte() = Await response.Content.ReadAsByteArrayAsync()
      ' Save the response as a PDF file
      Dim filePath As String = HttpContext.Current.Server.MapPath("../Doc_Uploads/Waybill.pdf")
      File.WriteAllBytes(filePath, responseBytes)
      Console.WriteLine("PDF saved successfully.")
  End Function