|
return RedirectToAction("Index"); |
If the site where the plugin is installed have some catch-all routing configured, for example like so:
app.UseEndpoints(endpoints => {
endpoints.MapControllerRoute(name: "Default", pattern: "{controller}/{action}/{id?}");
...
}
The return RedirectToAction("Index"); response when saving admin settings will 404 as the default route will catch it and generate /SiteimproveAdmin/Index as URL.
As the siteimprove plugin should not dictate how routing can or cannot be configured on the site, my suggestion is to instead resolve the same URL as is already done on line 50 of the same class and use that as redirect URL:
|
PluginUrl = _moduleResourceResolver.ResolvePath(Constants.SiteImproveModuleName, "SiteimproveAdmin"), |
So something like this:
var url = _moduleResourceResolver.ResolvePath(Constants.SiteImproveModuleName, "SiteimproveAdmin");
return Redirect(url);
// or with query in EnablePrepublishCheck:
return Redirect(url + "?prepublishError=true");
CMS-plugin-Optimizely/SiteImprove.Optimizely.Plugin/Controllers/SiteimproveAdminController.cs
Line 77 in e21ba9d
If the site where the plugin is installed have some catch-all routing configured, for example like so:
The
return RedirectToAction("Index");response when saving admin settings will 404 as the default route will catch it and generate/SiteimproveAdmin/Indexas URL.As the siteimprove plugin should not dictate how routing can or cannot be configured on the site, my suggestion is to instead resolve the same URL as is already done on line 50 of the same class and use that as redirect URL:
CMS-plugin-Optimizely/SiteImprove.Optimizely.Plugin/Controllers/SiteimproveAdminController.cs
Line 50 in e21ba9d
So something like this: