public ActionResult GetLicense(Guid opvId) { var orderProductVariant = _orderService.GetOrderProductVariantByGuid(opvId); if (orderProductVariant == null) { return(RedirectToAction("Index", "Home")); } var order = orderProductVariant.Order; var productVariant = orderProductVariant.ProductVariant; if (!_orderProcessingService.IsLicenseDownloadAllowed(orderProductVariant)) { return(Content("Downloads are not allowed")); } if (_customerSettings.DownloadableProductsValidateUser) { if (_workContext.CurrentCustomer == null) { return(new HttpUnauthorizedResult()); } if (order.CustomerId != _workContext.CurrentCustomer.Id) { return(Content("This is not your order")); } } var download = _downloadService.GetDownloadById(orderProductVariant.LicenseDownloadId.HasValue ? orderProductVariant.LicenseDownloadId.Value : 0); if (download == null) { return(Content("Download is not available any more.")); } if (download.UseDownloadUrl) { //return result return(new RedirectResult(download.DownloadUrl)); } else { if (download.DownloadBinary == null) { return(Content("Download data is not available any more.")); } string fileName = download.Filename ?? productVariant.Id.ToString(); //return result return(new FileContentResult(download.DownloadBinary, download.ContentType) { FileDownloadName = fileName + download.Extension }); } }