Table of Contents

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 string

The full name of the file in the file system as is to be served to the user.

pExpirationMinutes int

The expiration of the response in minutes. Use -1 for direct expiration.

pDownload bool

A boolean indicating the file is to be saved (downloaded) instead of being opened in the browser.

pDeleteFileAfterServe bool

A 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 string

A 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 string

The 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 string

The blob data as binary string. If unicode is sent out, a UnicodeToUTF8 must be performed on the data before setting this parameter.

pExpirationMinutes int

The expiration of the response in minutes. Use -1 for direct expiration.

pDownload bool

A boolean indicating the file is to be saved (downloaded) instead of being opened in the browser.

pContentType string

A 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

bool

Properties

BlobData

This property gets/sets the BlobData as a binary string.

public string BlobData { get; set; }

Property Value

string

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

string

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

bool

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

int

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

string

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

string

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

string

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

Returns

ReturnBlobResponse