Skip to content

Commit e34a167

Browse files
samsp-msftguardrex
andauthored
Apply suggestions from code review
Co-authored-by: Luke Latham <1622880+guardrex@users.noreply.github.com>
1 parent 46ff3cd commit e34a167

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

aspnetcore/performance/rate-limit.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,27 +145,27 @@ app.UseEndpoints(endpoints =>
145145

146146
#### Apply rate limiting to server-side Blazor apps
147147

148-
To set rate limiting to all pages, [`RequireRateLimiting(Policy)`](/dotnet/api/microsoft.aspnetcore.builder.ratelimiterendpointconventionbuilderextensions.requireratelimiting) can be specified on the MapRazorComponents call, for example:
148+
To set rate limiting for all of the app's routable Razor components, specify <xref:Microsoft.AspNetCore.Builder.RateLimiterEndpointConventionBuilderExtensions.RequireRateLimiting%2A> with the rate limiting policy name on the <xref:Microsoft.AspNetCore.Builder.RazorComponentsEndpointRouteBuilderExtensions.MapRazorComponents%2A> call in the `Program` file. In the following example, the rate limiting policy named "`policy`" is applied:
149149

150150
``` csharp
151151
app.MapRazorComponents<App>()
152152
.AddInteractiveServerRenderMode()
153-
.RequireRateLimiting("Policy");
153+
.RequireRateLimiting("policy");
154154
```
155155

156-
To set a policy for a single Razor component, the [`[EnableRateLimiting]` attribute](xref:Microsoft.AspNetCore.RateLimiting.EnableRateLimitingAttribute) is applied to the component with an optional policy name:
156+
To set a policy for a single routable Razor component or a folder of components via an `_Imports.razor` file, the [`[EnableRateLimiting]` attribute](xref:Microsoft.AspNetCore.RateLimiting.EnableRateLimitingAttribute) is applied with the policy name. In the following example, the rate limiting policy named "`override`" is applied. The policy replaces any policies currently applied to the endpoint. The global limiter still runs on the endpoint with this attribute applied.
157157

158158
``` blazor
159159
@page "/counter"
160160
@using Microsoft.AspNetCore.RateLimiting
161-
@attribute [EnableRateLimiting("Policy")]
161+
@attribute [EnableRateLimiting("override")]
162162
163163
<h1>Counter</h1>
164164
```
165165

166-
The [`DisableRateLimiting`](/dotnet/api/microsoft.aspnetcore.ratelimiting.disableratelimitingattribute) attribute can be used to disable rate limiting on a Razor Page.
166+
The [`DisableRateLimiting` attribute](xref:Microsoft.AspNetCore.RateLimiting.DisableRateLimitingAttribute) is used to disable rate limiting for a routable component or a folder of components via an `_Imports.razor` file.
167167

168-
The [`[EnableRateLimiting]` attribute](xref:Microsoft.AspNetCore.RateLimiting.EnableRateLimitingAttribute) is only applied to a component if <xref:Microsoft.AspNetCore.Builder.RateLimiterEndpointConventionBuilderExtensions.RequireRateLimiting%2A> is ***not*** called on <xref:Microsoft.AspNetCore.Builder.RazorComponentsEndpointRouteBuilderExtensions.MapRazorComponents%2A>.
168+
The [`[EnableRateLimiting]` attribute](xref:Microsoft.AspNetCore.RateLimiting.EnableRateLimitingAttribute) is only applied to a routable component or a folder of components via an `_Imports.razor` file if <xref:Microsoft.AspNetCore.Builder.RateLimiterEndpointConventionBuilderExtensions.RequireRateLimiting%2A> is ***not*** called on <xref:Microsoft.AspNetCore.Builder.RazorComponentsEndpointRouteBuilderExtensions.MapRazorComponents%2A>.
169169

170170
## Rate limiter algorithms
171171

0 commit comments

Comments
 (0)