Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion Rotativa/AsResultBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ public string CookieName
[Obsolete(@"Use BuildFile(this.ControllerContext) method instead and use the resulting binary data to do what needed.")]
public string SaveOnServerPath { get; set; }

public ContentDisposition ContentDisposition { get; set; }

protected abstract string GetUrl(ControllerContext context);

/// <summary>
Expand Down Expand Up @@ -218,8 +220,13 @@ protected HttpResponseBase PrepareResponse(HttpResponseBase response)
response.ContentType = this.GetContentType();

if (!String.IsNullOrEmpty(this.FileName))
response.AddHeader("Content-Disposition", string.Format("attachment; filename=\"{0}\"", SanitizeFileName(this.FileName)));
{
var contentDisposition = this.ContentDisposition == ContentDisposition.Attachment
? "attachment"
: "inline";

response.AddHeader("Content-Disposition", string.Format("{0}; filename=\"{1}\"", contentDisposition, SanitizeFileName(this.FileName)));
}
response.AddHeader("Content-Type", this.GetContentType());

return response;
Expand Down
6 changes: 6 additions & 0 deletions Rotativa/Options/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,4 +174,10 @@ public enum ImageFormat
jpeg,
png
}

public enum ContentDisposition
{
Attachment = 0, // this is the default
Inline
}
}