From cefda93b3428dfbbd1c74c2bf9e79710f2002bd5 Mon Sep 17 00:00:00 2001 From: praveensf4999 <197725958+praveensf4999@users.noreply.github.com> Date: Tue, 24 Jun 2025 11:37:08 +0530 Subject: [PATCH] 965445: Updated UG document for new feature in get image --- .../how-to/pass-custom-value-to-server.md | 45 +++++++++---------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/ej2-asp-core-mvc/file-manager/how-to/pass-custom-value-to-server.md b/ej2-asp-core-mvc/file-manager/how-to/pass-custom-value-to-server.md index 98ac96279a..eba366d924 100644 --- a/ej2-asp-core-mvc/file-manager/how-to/pass-custom-value-to-server.md +++ b/ej2-asp-core-mvc/file-manager/how-to/pass-custom-value-to-server.md @@ -181,7 +181,7 @@ public object Download([FromBody] FileManagerDirectoryContent args) ## 4. For GetImage Operation -For the **GetImage** operation, use the **beforeImageLoad** event to pass custom value. Since the **GetImage** operation doesn't support custom headers in HTTP requests, pass the custom values along with **imageUrl** using query parameters instead. +For the **GetImage** operation, use the beforeImageLoad event. Inside this event, set useImageAsUrl to false to instruct the FileManager not to load the image directly via its URL but instead to use a fetch request. Here, attach the **Authorization** header with the value **User1** within the beforeSend event of the ajaxSettings. {% if page.publishingplatform == "aspnet-core" %} ```ts @@ -199,8 +199,14 @@ For the **GetImage** operation, use the **beforeImageLoad** event to pass custom @@ -222,35 +228,28 @@ For the **GetImage** operation, use the **beforeImageLoad** event to pass custom ``` {% endif %} -In server-side, you can able to get the custom query parameter value using **Authorization** in `GetImage` method. To get the custom query parameter value, extend the `FileManagerDirectoryContent` class and add the custom property **Authorization**. +In server-side, `GetImage` method access the **Authorization** header from the incoming HTTP request and perform the necessary operations. ```typescript -public class FileManagerAccessController : Controller +[Route("GetImage")] +public object GetImage([FromBody] FileManagerDirectoryContent args) { - ... - public class FileManagerDirectoryContent1 : FileManagerDirectoryContent - { - public string Authorization { get; set; } - } - ... - - // gets the image(s) from the given path - [Route("GetImage")] - public IActionResult GetImage(FileManagerDirectoryContent1 args) - { - var header = args.Authorization; - return this.operation.GetImage(args.Path, args.Id, false, null, null); - } - - ... + var header = HttpContext.Request.Headers["Authorization"]; + return this.operation.GetImage(args.Path, args.Id, false, null, null); }