diff --git a/aspnetcore/grpc/json-transcoding-binding/Program.cs b/aspnetcore/grpc/json-transcoding-binding/Program.cs index b7fa23db76..504cad5172 100644 --- a/aspnetcore/grpc/json-transcoding-binding/Program.cs +++ b/aspnetcore/grpc/json-transcoding-binding/Program.cs @@ -10,10 +10,13 @@ builder.Services.AddSwaggerGen(c => var app = builder.Build(); app.UseSwagger(); -app.UseSwaggerUI(c => +if (app.Environment.IsDevelopment()) { - c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1"); -}); + app.UseSwaggerUI(c => + { + c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1"); + }); +} app.MapGrpcService(); app.Run(); diff --git a/aspnetcore/grpc/json-transcoding-openapi/Program2.cs b/aspnetcore/grpc/json-transcoding-openapi/Program2.cs index 1ccc96856c..b41abc57b4 100644 --- a/aspnetcore/grpc/json-transcoding-openapi/Program2.cs +++ b/aspnetcore/grpc/json-transcoding-openapi/Program2.cs @@ -15,10 +15,13 @@ builder.Services.AddSwaggerGen(c => var app = builder.Build(); app.UseSwagger(); -app.UseSwaggerUI(c => -{ - c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1"); -}); +if (app.Environment.IsDevelopment()) +{ + app.UseSwaggerUI(c => + { + c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1"); + }); +} app.MapGrpcService(); app.Run(); diff --git a/aspnetcore/security/authentication/cookie.md b/aspnetcore/security/authentication/cookie.md index cf0beb6f38..4b47bb96db 100644 --- a/aspnetcore/security/authentication/cookie.md +++ b/aspnetcore/security/authentication/cookie.md @@ -70,7 +70,7 @@ The Cookie Policy Middleware setting for `MinimumSameSitePolicy` can affect the To create a cookie holding user information, construct a . The user information is serialized and stored in the cookie. -Create a with any required s and call to sign in the user: +Create a with any required s and call to sign in the user. `Login.cshtml.cs` in the sample app contains the following code: [!code-csharp[](cookie/samples/6.x/CookieSample/Pages/Account/Login.cshtml.cs?name=snippet1&highlight=22-59)] diff --git a/aspnetcore/tutorials/getting-started-with-NSwag.md b/aspnetcore/tutorials/getting-started-with-NSwag.md index 257913dc98..92459e3c5b 100644 --- a/aspnetcore/tutorials/getting-started-with-NSwag.md +++ b/aspnetcore/tutorials/getting-started-with-NSwag.md @@ -29,7 +29,7 @@ Install NSwag to: * Serve the Swagger UI to browse and test the web API. * Serve the Redoc to add API documentation for the Web API. -To use the [NSwag](https://github.com/RicoSuter/NSwag) ASP.NET Core middleware, install the [NSwag.AspNetCore](https://www.nuget.org/packages/NSwag.AspNetCore/) NuGet package. This package contains the middleware to generate and serve the Swagger specification, Swagger UI (v2 and v3), and [ReDoc UI](https://github.com/Rebilly/ReDoc). +To use the [NSwag](https://github.com/RicoSuter/NSwag) ASP.NET Core middleware, install the [NSwag.AspNetCore](https://www.nuget.org/packages/NSwag.AspNetCore/) NuGet package. This package contains the middleware to generate and serve the Swagger specification, Swagger UI (v2 and v3), and [ReDoc UI](https://github.com/Rebilly/ReDoc). NSwag 14 supports only v3 of the Swagger UI spec. Use one of the following approaches to install the NSwag NuGet package: diff --git a/aspnetcore/tutorials/web-api-help-pages-using-swagger/samples/6.x/SwashbuckleSample/Snippets/Program.cs b/aspnetcore/tutorials/web-api-help-pages-using-swagger/samples/6.x/SwashbuckleSample/Snippets/Program.cs index 76f45ead14..76c8f1b0c2 100644 --- a/aspnetcore/tutorials/web-api-help-pages-using-swagger/samples/6.x/SwashbuckleSample/Snippets/Program.cs +++ b/aspnetcore/tutorials/web-api-help-pages-using-swagger/samples/6.x/SwashbuckleSample/Snippets/Program.cs @@ -23,11 +23,14 @@ public static class Program // // - app.UseSwaggerUI(options => + if (builder.Environment.IsDevelopment()) { - options.SwaggerEndpoint("/swagger/v1/swagger.json", "v1"); - options.RoutePrefix = string.Empty; - }); + app.UseSwaggerUI(options => + { + options.SwaggerEndpoint("/swagger/v1/swagger.json", "v1"); + options.RoutePrefix = string.Empty; + }); + } // } diff --git a/aspnetcore/web-api/http-repl/samples/SwaggerApp/Startup.cs b/aspnetcore/web-api/http-repl/samples/SwaggerApp/Startup.cs index 472651a805..7e2fb45d5e 100644 --- a/aspnetcore/web-api/http-repl/samples/SwaggerApp/Startup.cs +++ b/aspnetcore/web-api/http-repl/samples/SwaggerApp/Startup.cs @@ -32,11 +32,11 @@ namespace SwaggerApp public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { app.UseOpenApi(); - app.UseSwaggerUi3(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); + app.UseSwaggerUi3(); } else {