You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
I have a frame on an mvc view which I want to load the contents from a stream I am getting thru an Action.
The Action code is this
[HttpGet]
public ActionResult DownloadShipmentLabel2(Int64 fileID, bool inline = false)
{
clsConsignmentFilesHelper myHelper = null;
string sErrorMessage = null, sFileName = null;
try
{
sFileName = clsDBFunctions.GetFieldFromKey("CR_Consignment_Files", "ID", fileID, "FileName", ConnectionString.GetConnectionString(clsDefaults.eCompanyFunctionality.FedEx)).ToString();
if (!string.IsNullOrWhiteSpace(sFileName))
{
string mimeType = System.Web.MimeMapping.GetMimeMapping(sFileName);
myHelper = new clsConsignmentFilesHelper(ConnectionString.GetConnectionString(clsDefaults.eCompanyFunctionality.FedEx));
byte[] buffer = myHelper.DownloadConsignmentFileToBytes(fileID, "FedEx", out sErrorMessage);
if (buffer != null)
{
MemoryStream stream = new MemoryStream(buffer);
if (inline)
Response.AddHeader("Content-Disposition", $"inline; filename={sFileName}");
else
Response.AddHeader("Content-Disposition", $"attachment; filename={sFileName}");
Then I have the following script to fill the frame with the pdf contents
function printConsignmentFile(fileID) {
const iframe = document.getElementById('viewer');
}
but I keep getting the following error in fetch_stream.js function fetchUrl
GET http://localhost:30114/fedex/DownloadShipmentLabel2%3FfileID%3D1316333 400 (Bad Request).
The url is fine cause when it is not inline the file is downloaded.
Can someone please help?
Thanks
Ivan
All reactions