I need to redirect to a path under the current module:
modulePath = "/test";
Get["/there"] = ...
Get["/here"] = routeParams => { return ????????????("/there"); }
I expect "/test/here" to redirect to "/test/there"
You can use named routes and Nancy.Linker. See https://github.com/horsdal/Nancy.Linker
That is install Nancy.Linker
from NuGet, take a dependency on IResourceLinker
and change the code to:
public class YourModule
{
public YourModule(IResourceLinker linker)
{
Get["theRoute", "/there"] = ...
Get["/here"] = Response.AsRedirect(linker.BuildAbsoluteUri(this.Context, "theRoute");
}
{
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With