Interface IDynamicWebApi
This interface extends WebAPIs with File-Save helpers. It's important, because if 2sxc also runs on other CMS platforms, then the Dnn Context won't be available, so it's in a separate interface.
[PublicApi_Stable_ForUseInYourCode]
public interface IDynamicWebApi
Methods
File(NoParamOrder, bool?, string, string, string, object)
Create a File-result to stream to the client
Typical use: return File(download: true, contentType: "text/xml", contents: ...);
dynamic File(NoParamOrder noParamOrder = default, bool? download = null, string virtualPath = null, string contentType = null, string fileDownloadName = null, object contents = null)
Parameters
noParamOrder
NoParamOrderdownload
bool?If a download should be enforced (otherwise the file may just be displayed - like an image)
virtualPath
stringPath in the website to get the file from. Provide either virtualPath or contents
contentType
stringMime Content-type. Will try to auto-detect from virtualPath or fileDownloadName if not provided.
fileDownloadName
stringDownload name. If provided, it will try to force download/save on the browser.
contents
objectContent of the result - a string, byte[] or stream to include.
Returns
- dynamic
Remarks
Added in 2sxc 12.05
SaveInAdam(NoParamOrder, Stream, string, string, Guid?, string, string)
Save a file from a stream (usually an upload from the browser) into an adam-field of an item. Read more about this in the the WebAPI docs for SaveInAdam
IFile SaveInAdam(NoParamOrder noParamOrder = default, Stream stream = null, string fileName = null, string contentType = null, Guid? guid = null, string field = null, string subFolder = "")
Parameters
noParamOrder
NoParamOrderstream
Streamthe stream
fileName
stringfile name to save to
contentType
stringcontent-type of the target item (important for security checks)
guid
Guid?field
stringsubFolder
string