Skip to content
Open
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/AsPdfResultBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ public string CookieName
set { FormsAuthenticationCookieName = value; }
}

/// <summary>
/// This will be send to the browser as the content disposition telling it how to return the document
/// </summary>
public ContentDisposition ContentDisposition { get; set; }

/// <summary>
/// Custom name of authentication cookie used by forms authentication.
/// </summary>
Expand Down Expand Up @@ -277,8 +282,10 @@ protected HttpResponseBase PrepareResponse(HttpResponseBase response)
{
response.ContentType = ContentType;

string contentDisposition = ContentDisposition == ContentDisposition.Inline ? "inline" : "attachment";

if (!String.IsNullOrEmpty(FileName))
response.AddHeader("Content-Disposition", string.Format("attachment; filename=\"{0}\"", SanitizeFileName(FileName)));
response.AddHeader("Content-Disposition", string.Format("{0}; filename=\"{1}\"", contentDisposition, SanitizeFileName(FileName)));

response.AddHeader("Content-Type", ContentType);

Expand Down
6 changes: 6 additions & 0 deletions Rotativa/Options/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,10 @@ public enum Orientation
Landscape,
Portrait
}

public enum ContentDisposition
{
Attachment,
Inline
}
}