0

I am currently making an application in Blazor Server Side. 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?

Blazor Server side uses signalR so maybe there is a way that I don't know of to limit the total transfer size

YaRmgl
  • 356
  • 1
  • 6
  • 19
  • Maybe settings MaxRequestLength in the web.config where the request is send to? https://stackoverflow.com/questions/11438317/how-is-the-property-in-webconfig-maxrequestlength-measured – VDWWD Oct 31 '21 at 10:29
  • @VDWWD there is no web.config in blazor, at least that I know of – YaRmgl Oct 31 '21 at 10:45

1 Answers1

0

You could add a data annotation to your property such as [StringLength(255)].

klekmek
  • 533
  • 3
  • 11