RichEditBuilder.ExportUrl(String) Method
Specifies the path where the exported document is sent for saving.
Namespace: DevExpress.AspNetCore.RichEdit
Assembly: DevExpress.AspNetCore.RichEdit.v24.2.dll
NuGet Package: DevExpress.AspNetCore.RichEdit
#Declaration
public RichEditBuilder ExportUrl(
string url
)
#Parameters
Name | Type | Description |
---|---|---|
url | String | The URL. |
#Returns
Type | Description |
---|---|
Rich |
An object that can be used to further configure the Rich Text Editor. |
#Remarks
Set the ExportUrl property to process document saving on the server side.
Note
The Export
@(Html.DevExpress().RichEdit("richEdit")
.ExportUrl(Url.Action("Export"))
.Height(600)
.ConfirmOnLosingChanges(c => c.Enabled(false))
)
public IActionResult Export(string base64, string fileName, DevExpress.AspNetCore.RichEdit.DocumentFormat format, string reason) {
byte[] fileContents = System.Convert.FromBase64String(base64);
return Ok();
}
Note
If you apply the [Api
public IActionResult Export([FromForm]string base64, [FromForm]string fileName, [FromForm]int format, [FromForm]string reason) {
byte[] fileContents = System.Convert.FromBase64String(base64);
return Ok();
}
#For Razor Pages web apps only
To use the ExportUrl method in a Razor Pages web app, it is necessary to add the following adjustments.
Disable the AntiForgeryToken option (enabled for Razor Pages web apps by default).
To disable the AntiForgeryToken for an application, add the following code in the Program.cs file:
C#builder.Services.AddMvc().AddRazorPagesOptions(o => { o.Conventions.ConfigureFilter(new Microsoft.AspNetCore.Mvc.IgnoreAntiforgeryTokenAttribute()); });
To disable the AntiForgeryToken for a page, add the following code to a page model.
C#[IgnoreAntiforgeryToken] public class IndexModel : PageModel { public void OnPost() { } }
Declare a POST action handler to save a document.
public void OnPostExport(string base64, string fileName, DevExpress.AspNetCore.RichEdit.DocumentFormat format, string reason) {
byte[] fileContents = System.Convert.FromBase64String(base64);
}
Use this handler in the ExportUrl method as follows.
.ExportUrl("RichEditPage?handler=export")
See also: Add RichEdit to a .NET Core Application