I'm a bit confused about the ~
path in Asp.NET 6.x
Assume my Web site is hosted on IIS at: http://somesite.org/special/
I'm using Carter Lib but I don't think that should matter.
public LogoutModule()
{
Get("/api/admin/logout", async ctx =>
{
await ctx
.SignOutAsync("Cookies")
.ConfigureAwait(false);
ctx.Session.Clear();
ctx.Response.Redirect("~/");
});
}
I thought the redirect would go to http://somesitename.org/special
but instead it goes to:
http://somesitename.org/special/api/admin/~/
Redirecting using ctx.Response.Redirect("/");
doesn't work either. It then goes to:
http://somesitename.org/
In general I don't know the virtual directory this site is hosted in. I thought the ~
operator took care of that. What don't I understand here?