I need to handle an incoming request which is of the form: //ohif/study/1.1/series Note the exta slash at the front
My controller signature is:
[Rout
What about the middleware to handle double slash?
app.Use((context, next) =>
{
if (context.Request.Path.Value.StartsWith("//"))
{
context.Request.Path = new PathString(context.Request.Path.Value.Replace("//", "/"));
}
return next();
});
Rewrite the URL at the web server-level, e.g. for IIS, you can use the URL Rewrite Module to automatically redirect //ohif/study/1.1/series
to /ohif/study/1.1/series
. This isn't a job for your application.