Istudent Rana

Istudent Rana

  • 1.4k
  • 361
  • 85.1k

How do i disable swashbuckle swagger UI in production in asp

Jan 7 2020 7:34 AM
I using swashbuckle v 5.6.0 for api documentation and ui for test in asp.net web api2.
I do not want give ability for the user to post data from swagger ui in production.
How do I disable it?
 
  GlobalConfiguration.Configuration
.EnableSwagger(c =>
{
c.Schemes(new[] { "http", "https" });
c.SingleApiVersion("v1", "Demo API");
c.PrettyPrint();
c.IncludeXmlComments(GetXmlCommentsPath());
})
.EnableSwaggerUi(c =>
{
c.DisableValidator();
});

Answers (1)