简体   繁体   English

如何限制 Blazor 服务器端请求大小

[英]How to limit Blazor Server Side request size

I am currently making an application in Blazor Server Side.我目前正在 Blazor 服务器端制作应用程序。 I am afraid of one thing, in the following component:我害怕一件事,在以下组件中:

<input @bind="Text"/>

@code{
    string Text = string.Empty;
}

Say if some attacker were to paste a 1GB string in the input, how could I prevent the payload from reaching the server?假设某个攻击者要在输入中粘贴一个 1GB 的字符串,我该如何阻止有效负载到达服务器?

Blazor Server side uses signalR so maybe there is a way that I don't know of to limit the total transfer size Blazor 服务器端使用 signalR 所以也许有一种我不知道的方法来限制总传输大小

您可以向您的属性添加数据注释,例如[StringLength(255)]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM