Hi,
Is there sample / way to redirect service side to an external url after a command execution?
Environment
Xperience by Kentico version: 30.8.2
.NET version: 9
Link to relevant Redirect to another page after command execution
You have no notifications.
Hi,
Is there sample / way to redirect service side to an external url after a command execution?
Environment
Xperience by Kentico version: 30.8.2
.NET version: 9
Link to relevant Redirect to another page after command execution
Something that would be Kentico specific, highly unlikely. However, you could look at these two different types of approaches. These approaches assume you want to execute the same code for both examples.
<form> element and place a <inout type="hidden"> element and a <button> element inside it. Your <input type="hidden"> element would look something like this: <input type="hidden" name="redirectUrl" value="@RedirectURL" /><button asp-controller="YourControllerName" asp-action="YourActionName" type="submit">@ButtonText</button>YourControllerName/YourActionName controller action, perform the work you want to do before redirecting to the external URL which is provided in the <input type="hidden"> value. Or it can be hardcoded (not recommended) if you wish.If you want to be more dynamic about it, then you could provide more input properties for the end user to provide input for.
after a command execution
Are you asking about redirects in the administration UI or in a website channel?
Thanks for the unintentional rubber ducking :)
I was completely stuck in the Xperience UI page commands bubble. What I needed was a simple API controller that I could call with a custom layout template.
import React, { useState } from "react";
import {LinkButton} from "@kentico/xperience-admin-components";
interface CustomLayoutProps {
readonly apiEndpoint: string;
}
export const CustomLayoutTemplate = ({ apiEndpoint } : CustomLayoutProps) => {
return (
<div>
<LinkButton label="Call endpoint" href={apiEndpoint} />
</div>
);
};
The api controller endpoint can be secured using Secure custom endpoints
To response this discussion, you have to login first.