0

I have a web application with a multiline textbox as an input field, however it appears that the data is being restricted to 2048 characters in the code-behind.

According to MSDN thats not expected, as it says:

For multiline text box controls, the maximum number of characters the user can enter is 4294967295 or an amount based on available memory, whichever is smaller.

However, the Textbox.text property is truncated to 2048 characters. Most of my searching for answers is people asking how to restrict the length on a multiline textbox but I'm having the opposite issue - I don't want the text restricted to 2048 (it will be restricted but more text is supposed to be allowed than 2048 characters).

Apologies if I'm missing something obvious, any input would be appreciated.

Thanks.

Nerph
  • 1
  • 1
  • Just making sure you're sending the data via POST? – Sami Kuhmonen Jun 01 '15 at 11:53
  • How are you generating the multiline text box? Show the markup and all the attributes for the property if you have one. – freedomn-m Jun 01 '15 at 13:07
  • http://stackoverflow.com/help/mcve – freedomn-m Jun 01 '15 at 13:07
  • Thanks Sami, yes sending via POST – Nerph Jun 01 '15 at 13:11
  • 1
    Thanks freedomn-m, I read the link you posted so decided to create a small app just to test. Now I'm stumped, copied the control across so has the same attributes but its reading the full length of entered data correctly in the code-behind. Obviously something in the main application somewhere causing this to happen. I'm wondering if there is a way to limit this on a global level in the application that has been added previously. – Nerph Jun 01 '15 at 13:33

1 Answers1

0

By default Textbox has no restrictions on number of charachters, this limitation comes to place when you are setting TextMode to SingleLine or Password. On the server side what size of the variable which gets your TextBox value? I think the truncation occures there

Please check your configuration file - there is the default limitation on data size that can be posted to the website (security reasons) for greater details on how to change the size please look at this article

Community
  • 1
  • 1
Yuri
  • 2,820
  • 4
  • 28
  • 40
  • Thanks Yuri, I'm grabbing the length of the entered text (ie. TextBox.Text.Length) before assigning to a variable while I'm trying to work this out. – Nerph Jun 01 '15 at 13:34