0

I am currently using a multiline textbox for my users to submit very large strings of data to me. I noticed that multiline text boxes have a maximum capacity of around 4 billion characters or memory that's available (whichever is smaller.) The string that I am using for test purposes is well below 4billion characters). However I'm still unable to submit my data. When I click the submit button, the data is programmed to write to a .txt file in root folder AND the data gets printed on screen using a label:

<asp:Label ID="lblmsg" Font-Bold="false"  style="white-space:pre;"  runat="server" Text=""></asp:Label>

On Safari, I get the required validation error before I can submit. (If I disable the validation code, I get re-routed to my web app's error page on submission.)

And on Chrome I get no validation error, I click submit, the input gets uploaded to 100% and then I get my web app's error page.

I'm thinking, the reason for my error could be any of the possible reasons:

1) Either the label or web app can't handle that much data on one page. Or:

2) I am using the basic Microsoft Azure web app service plan to host my webform. Maybe there is a processing restriction that I am hitting.

Here is the code for my validator code: (Even though I don't think that's the problem.

<asp:RequiredFieldValidator  ValidationGroup="g1"  ControlToValidate="txtvalue" ForeColor="Red"  ID="RequiredFieldValidator1" runat="server" ErrorMessage="empty or contains more than 4,294,967,295 characters (or an amount based on available memory, whichever is smaller)."></asp:RequiredFieldValidator>
                        <br />  <asp:RequiredFieldValidator  ValidationGroup="g1"  ControlToValidate="txtvalue2" ForeColor="Red"  ID="RequiredFieldValidator2" runat="server" ErrorMessage=" empty or contains more than 4,294,967,295 characters (or an amount based on available memory, whichever is smaller.)"></asp:RequiredFieldValidator>
                        <br /> <asp:RegularExpressionValidator  ValidationGroup="g1" ForeColor="Red"  ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtvalue" ErrorMessage="Invalid delimiter format. Make sure to use one consistent delimeter: (comma, space, or tab)." ValidationExpression="^\s*-?[0-9][0-9]*\s*(?=([., \t]))(?:\s*(?:\1|\r?\n)\s*-?[0-9][0-9]*)+\s*$"></asp:RegularExpressionValidator>
                        <br /> <asp:RegularExpressionValidator  ValidationGroup="g1"  ForeColor="Red" ID="RegularExpressionValidator2" runat="server" ControlToValidate="txtvalue2" ErrorMessage="Invalid delimiter format. Make sure to use one consistent delimeter: (comma, space, or tab)." ValidationExpression="^\s*-?[0-9][0-9]*\s*(?=([., \t]))(?:\s*(?:\1|\r?\n)\s*-?[0-9][0-9]*)+\s*$"></asp:RegularExpressionValidator>

Here is my web.config code which I think is also okay:

<configuration>
<system.web>
  <compilation targetFramework="4.5" />
  <!-- 50MB in kilobytes, default is 4096 or 4MB-->
  <httpRuntime maxRequestLength="1073741824" executionTimeout="3600" targetFramework="4.5" />
  <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
  </system.web>
  <system.webServer>
  <security>
  <requestFiltering>
    <!-- 50MB in bytes, default is 30000000 or approx. 28.6102 Mb-->
    <requestLimits maxAllowedContentLength="52428800" /> 
  </requestFiltering>
  </security>
  </system.webServer>
<appSettings>
    <add key="ValidationSettings:UnobtrusiveValidationMode" value="None" />
</appSettings>
</configuration>

And here is the link to the input I'm testing with.

Community
  • 1
  • 1
justinpees
  • 420
  • 5
  • 20
  • 1
    What are you dealing with that you need 4 billion characters in an input on your site? – mason Aug 23 '17 at 17:45
  • That is around 3.8 gb. Seems a bit much to copy paste into a textbox. – VDWWD Aug 23 '17 at 18:18
  • Why not upload files? I think you are trap in a [XY problem](https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem). – Circle Hsiao Aug 24 '17 at 08:02
  • @VDWWD what is around 3.8gb? If I copy the contents of my matrix into a text file it is only 5mb (although my matrix wasn't 4 billion characters) – justinpees Aug 24 '17 at 13:08
  • @justinpees 4 billion chars of plain text is around that size I believe, and yet you are asking about more input size. 5 mb is nowhere near 4b chars. – VDWWD Aug 24 '17 at 13:14
  • @VDWWD maybe the problem lies within my validation or the processing power dedicated to my web app. Because when I split the 5mb string in half, and paste each half in a separate multi line text box it's fine. But then when I paste the entire 5mb string into ONE text box, I get a validation error. Could my web service's processing power be the problem? I'm currently using Microsoft Azure lowest tier package. (Free or basic) – justinpees Aug 24 '17 at 14:14
  • @VDWWD the other thing I'm thinking is that maybe regex validations have default timeouts or max amount of characters it can check? – justinpees Aug 24 '17 at 15:24
  • Please read [ask] and create a [mcve]. Without code and actual input not much meaningful can be said about this. – CodeCaster Aug 24 '17 at 15:29
  • @CodeCaster you don't need to see any code. If you read the question you would see that the string passes validation when it is pasted in halfs. But when I paste the string in full, it doesn't pass. And the validation error is returned as if the field is empty. So obviously there is a limit somewhere. Seeing as how my string is not 4 billion characters, I must be exceeding a limit somewhere else. Either regex can only validate a certain amount of data, or my web app service doesn't have enough processing power, or a timeout is reached somewhere. I'm using default configs everywhere. – justinpees Aug 24 '17 at 16:16
  • So show validation regex, how you apply it and some example input data that triggers the error. – CodeCaster Aug 24 '17 at 16:43
  • @CodeCaster I provided the validation code in question. – justinpees Aug 24 '17 at 17:02
  • @CodeCaster The input format is fine, its the length or something is limiting. – justinpees Aug 24 '17 at 17:02
  • Look, I mean you can trivially extract this regex and construct a `System.Text.RegularExpressions.Regex` to which you feed the erroneous input from a file, for example in a small console application consisting of a handful of lines. That's a MCVE. If that still reproduces the issue, it's .NET's Regex class, and not ASP.NET/validators. – CodeCaster Aug 24 '17 at 17:16
  • @CodeCaster the only way I'm able to provide you with a sample input is via this link here: https://www.ccrwest.org/cover/LARGE/C_48_6_5.html So when I took half of this array and places it in my text box, it was passed and same for the other half. But when I paste the full thing I get my error message saying field is empty. – justinpees Aug 24 '17 at 17:57
  • @CodeCaster I'm thinking I either have to configure regex to allow a longer timeout period, or I have to configure something in my Azure web app service. Let me know if you experience the same issue with that input I provided. – justinpees Aug 24 '17 at 18:00
  • @CodeCaster when I remove regex validation and submit the data I get redirected to my websites default error page. So it has to be an ASP.net issue right? – justinpees Aug 25 '17 at 17:24
  • @蕭為元 I want to offer both options – justinpees Aug 26 '17 at 08:55

1 Answers1

1

Perhaps make a button that calls JavaScript code which grabs the data directly from the clipboard? See below.

https://stackoverflow.com/a/6413100/3042383

lancew
  • 780
  • 4
  • 22