ASP.NET 4.5 / c#
I've been using a RegularExpressionValidator for multi-line textboxes that looks like this:
<asp:RegularExpressionValidator
ID="rev_txtEducationProfessional_courseDescription"
runat="server"
Display="None"
ValidationGroup="educationProfessional"
ControlToValidate="txtEducationProfessional_courseDescription"
ValidationExpression="(\s|.){0,500}$"
ErrorMessage="Course Description: 500 characters maximum"
EnableClientScript="false" />
I haven't had any issues with this up until now, but I'm having one that IMHO is very odd. So if I do something like type 501 letter Xs in the textbox, the validator fires fine. If I type 499 letter Xs with a couple of carriage returns, the validator fires fine. A user contacted me today with an issue with the site hanging. I traced the issue to the validator for the multiline textbox. The user is submitting well over 500 characters, but the site hangs and crashes on validation. When I run in debug, it is the Page.Validate that hangs (you may have guessed, all my validation is server side). I'm going to provide the text that causes the problem. I should note, if I paste in this text up to 500 characters, everything is fine...once I hit 501, my site takes a dump. There is something specific to this text in combination with how I am validating, "(\s|.){0,500}$", that is going very wrong, but I'm lost as to what the exact issue is. Without further ado, here is the entry that is the thorn in my side:
COMBINES DETAILED LECTURE REGARDING THE SCIENTIFIC BASIS FOR FRICTION RIDGE IDENTIFICATION WITH INTENSE LATENT PRINT COMPARISON PRACTICAL EXERCISES. THE LECTURE MATERIAL INCORPORATES THE RIDGEOLOGY CONCEPTS OF DAVID ASHBAUGH WITH THE PRACTICAL APPLICATION TECHNIQUES DEVELOPED BY PAT WERTHEIM.
RECOGNITION OF RIDGE PATTERN CLUES, IDENTIFYING WHICH FINGER OR WHICH AREA OF THE SKIN MADE A PARTICULAR LATENT IMPRESSION. THE CORRECT USE OF 3RD LEVEL DETAIL. PHILOSOPHY AND ACE-V METHODOLOGY OF COMPARING AND IDENTIFYING LATENT PRINTS.
I tried removing the hyphen. Also, the text came from Word, so I tried copying into notepad to remove any special formatting and tried removing the carriage return. Usually the site will run for several minutes and then say the page is not available without a specific error. I just tried in debug and have been waiting what seems like forever to get a response. I will add if anything useful comes up. I'm very curious if I have done something obviously wrong or perhaps I can work around this by modifying the regex.
Thanks all!