Skip to content

Instantly share code, notes, and snippets.

@nelsonlaquet
Created June 28, 2011 22:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nelsonlaquet/1052413 to your computer and use it in GitHub Desktop.
Save nelsonlaquet/1052413 to your computer and use it in GitHub Desktop.
[EnsureCustomerLoggedIn]
public ActionResult Download(Guid assetId)
{
var asset = _assets.GetAsset(assetId);
if (asset == null)
return Redirect(Url.RouteCatalog());
var filePath = _uploads.GetAbsolutePathForFile(asset.FileId.UploadId);
return File(filePath, _mimeTypes.GetMimeTypeForFile(filePath), asset.Name + Path.GetExtension(filePath));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment