|
@Html.EJS().FileManager("filemanager").BeforeSend("beforeSend").BeforeDownload("beforeDownload").AjaxSettings(new Syncfusion.EJ2.FileManager.FileManagerAjaxSettings
{
GetImageUrl = "http://localhost:62869/api/SQLProvider/SQLGetImage"
}).Render()
<script>
function beforeSend(args) {
var data = JSON.parse(args.ajaxSettings.data);
if (args.action == "Upload") {
// Allow custom data for upload operations
data.push({ 'username': "user1" });
args.ajaxSettings.data = JSON.stringify(data);
}
else {
// Add custom parameter column
data["username"] = "user1";
// Add custom parameter in ajax settings
args.ajaxSettings.data = JSON.stringify(data);
}
} |
|
public class FileManagerDirectoryContent1
{
public string username { get; set; }
public FileManagerDirectoryContent[] Data { get; set; }
public bool ShowHiddenItems { get; set; }
}
public object SQLFileOperations([FromBody] FileManagerDirectoryContent1 args)
{
if ((args.Action == "delete" || args.Action == "rename") && ((args.TargetPath == null) && (args.Path == "")))
{
FileManagerResponse response = new FileManagerResponse();
response.Error = new ErrorDetails { Code = "403", Message = "Restricted to modify the root folder." };
return operation.ToCamelCase(response);
}
} |
|
@Html.EJS().FileManager("filemanager").BeforeSend("beforeSend").BeforeDownload("beforeDownload").AjaxSettings(new Syncfusion.EJ2.FileManager.FileManagerAjaxSettings
{
GetImageUrl = "http://localhost:62869/api/SQLProvider/SQLGetImage"
}).Render()
<script>
function beforeDownload(args) {
var includeCustomAttribute = args.data;
includeCustomAttribute.username = "user1";
args.data = includeCustomAttribute;
}
</script> |
Hello, Thanks for the update but I would like to know how to avoid passing those parameters using " beforeSend " function of component.html file ? because that will be available in view source if unwanted user wants to hack it.
Hi Kaustubh,
Greetings from Syncfusion support.
As per the shared details, we understand that you need to avoid passing those parameters using the "beforeSend " event. In our previous update, we have sent JWT token from client end to perform customizations at server end. For getting client-side login user details in server side without sending it from client end, we suggest you refer to refer the below blob to get the details directly at server end and achieve your requirements.
Link 2: https://docs.microsoft.com/en-us/dotnet/api/system.environment.username?view=net-6.0
Please get back to us, if you need any further assistance.
Regards,
Sivakumar S