Class ReturnBlobResponse
- Namespace
- PolarStudio
- Assembly
- PolarStudio.dll
This class contains the data as can be returned when a blob is requested
public class ReturnBlobResponse
- Inheritance
-
ReturnBlobResponse
- Inherited Members
- Extension Methods
Constructors
ReturnBlobResponse()
Constructor.
public ReturnBlobResponse()
ReturnBlobResponse(string, int, bool, bool, string)
Constructor for returning an existing file in the server's local file system.
public ReturnBlobResponse(string pFileSystemFileName, int pExpirationMinutes = 44640, bool pDownload = false, bool pDeleteFileAfterServe = false, string pContentType = "")
Parameters
pFileSystemFileName
stringThe full name of the file in the file system as is to be served to the user.
pExpirationMinutes
intThe expiration of the response in minutes. Use -1 for direct expiration.
pDownload
boolA boolean indicating the file is to be saved (downloaded) instead of being opened in the browser.
pDeleteFileAfterServe
boolA boolean indicating the file in the file system is to be deleted after the response has been processed. Only use this flag when operating on temporary files.
pContentType
stringA content type (either a full content type like 'text/html' or only a file-extension like 'html' or '.html') to give the browser an indication of the returned content type.
ReturnBlobResponse(string, string, int, bool, string)
Constructor for easy creation of a blob response with dynamically created blob data.
public ReturnBlobResponse(string pFileName, string pBlobData, int pExpirationMinutes = 44640, bool pDownload = false, string pContentType = "")
Parameters
pFileName
stringThe name of the file (without path) as is shown in the browser as file name when saving. The content type is derived from the file extension when no explicit content type is specified. Does not have to match a name in the file system of an existing file.
pBlobData
stringThe blob data as binary string. If unicode is sent out, a UnicodeToUTF8 must be performed on the data before setting this parameter.
pExpirationMinutes
intThe expiration of the response in minutes. Use -1 for direct expiration.
pDownload
boolA boolean indicating the file is to be saved (downloaded) instead of being opened in the browser.
pContentType
stringA content type (either a full content type like 'text/html' or only a file-extension like 'html' or '.html') to give the browser an indication of the returned content type.
Fields
DeleteFileAfterServe
A boolean indicating a file-system file is to be deleted after the file has been served (either successful or when aborted).
public bool DeleteFileAfterServe
Field Value
Properties
BlobData
This property gets/sets the BlobData as a binary string.
public string BlobData { get; set; }
Property Value
ContentType
This property gets/sets the content type of the response. This can either be a full content type like 'text/html' or only a file-extension like 'html' or '.html'.
public string ContentType { get; set; }
Property Value
Download
This property can be set to True, to mark the file as Download. This means the browser will save the file in the file system (often the downloads folder) instead of opening the result of the file.
public bool Download { get; set; }
Property Value
ExpirationMinutes
Used to set the expiration of the http response in minutes. Use a negative value (-1) to directly expire.
public int ExpirationMinutes { get; set; }
Property Value
FileName
This property gets/sets the FileName. When setting, and no ContentType is yet known, the ContentType is set to the file-extension.
public string FileName { get; set; }
Property Value
FileSystemFileName
This property can be set to return a file directly from the accessible file system as blob result. This allowes for large files to be returned, as they are dynamically read from the file system and are not kept in memory. When serving files from the file system, the property DeleteFileAfterServe can be set to True if the (temporary) file is to be deleted after the response is processed.
public string FileSystemFileName { get; set; }
Property Value
Status
A http response status. When used, this status must be in the format '### message', like '508 Not allowed'. If additinal HTTP headers are to be added to the response, this can be done by accessing the Context.Request.WebResponse object, like: pContext.WebSession.Request.WebResponse.AddHeader "pragma", "no-cache".
public string Status { get; set; }
Property Value
Methods
BlobResponseFromResponseString(string)
For backwards compatibility only. This method creates a new ReturnBlobResponse object based on the old string-formatted response type.
public static ReturnBlobResponse BlobResponseFromResponseString(string pResonse)
Parameters
pResonse
string