Share via


ISpaPrerenderer.RenderToString(String, String, Object, Int32) Method

Definition

Invokes JavaScript code to perform server-side prerendering for a Single-Page Application. This is an alternative to using the 'asp-prerender-module' tag helper.

public System.Threading.Tasks.Task<Microsoft.AspNetCore.SpaServices.Prerendering.RenderToStringResult> RenderToString (string moduleName, string exportName = default, object customDataParameter = default, int timeoutMilliseconds = 0);
abstract member RenderToString : string * string * obj * int -> System.Threading.Tasks.Task<Microsoft.AspNetCore.SpaServices.Prerendering.RenderToStringResult>
Public Function RenderToString (moduleName As String, Optional exportName As String = Nothing, Optional customDataParameter As Object = Nothing, Optional timeoutMilliseconds As Integer = 0) As Task(Of RenderToStringResult)

Parameters

moduleName
String

The JavaScript module that exports a prerendering function.

exportName
String

The name of the export from the JavaScript module, if it is not the default export.

customDataParameter
Object

An optional JSON-serializable object to pass to the JavaScript prerendering function.

timeoutMilliseconds
Int32

If specified, the prerendering task will time out after this duration if not already completed.

Returns

Applies to