RegularExpressionValidator Always Fails, But ValidationExpression Works In Testing?
May 21, 2010
I found the answer to this, but it's a bit of a gotcha so I wanted to share it here.
I have a regular expression that validates passwords. They should be 7 to 60 characters with at least one numeric and one alpha character. Pretty standard. I used positive lookaheads (the (?= operator) to implement it:
(?=^.{7,60}$)(?=.*[0-9].*)(?=.*[a-zA-Z].*)
I checked this expression in my unit tests using Regex.IsMatch(), and it worked fine. However, when I use it in a RegularExpressionValidator, it always fails.
View 2 Replies
Similar Messages:
May 10, 2010
I am currently working on a web form where you need to make your own account. One of the required fields is where you need to fill in your postal code. I work with an RegularExpressionValidator. This exists out of 4 numbers. The first number may not be a zero. I know that I need the ValidationExpression (propertie of RegularExpressionValidator) but I don't know what to fill in.
View 1 Replies
Feb 25, 2010
RegularExpressionValidator.ValidationExpression="d{10}" means only digits - 10 max.
RegularExpressionValidator.ValidationExpression="d{10,12}" means only digits - 10, 11 or 12.
How to force strictly 10 or 12 symbols?
View 4 Replies
Nov 4, 2010
I have a ValidationExpression that works fine in IE8 and Firefox but client uses IE6 and it doesn't seem to work for them. The issue concerns special characters in a password text box, the clients wants to be able to INCLUDE special characters but IE6 doesn't seem to pick them.
Basically we want to be able to include any letter (upper and lower case) , any number and any special character. This is what I've got so far...
ValidationExpression="^(?=.*d)(?=.*[a-zA-Z]).{8,}$"
Like I said,
test123*
works ok on IE8 but IE6 doesn't seem to pick up special chars so thinks it's only 7 characters long..
View 2 Replies
Mar 3, 2011
I have the following problem, I make a web site when I run this website (locally) I get the correct data (for example I have a set of cities according to the city selection, I get the required data), but when I publish the web site and try it on line (I get incorrect data under the same conditions I tried before locally). I don't know what is the problem, I need to trace the code online (debug the code on line) to know where the problem. Is there any suggestions how to treat case like this, code works in correct manner locally but fails sometimes online? I use (https) online. I use static variable (supposed not to be changed) but online the value of this variable is changing and make this problem.
View 3 Replies
Jul 13, 2010
I have the following asp.net markup:
<asp:TextBox ID="txtPassword" runat="server" TextMode="Password"
ValidationGroup="passwordValidation"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" Display="Dynamic"
ControlToValidate="txtPassword" Text="Required" ValidationGroup="passwordValidation" />
<asp:RegularExpressionValidator runat="server" ControlToValidate="txtPassword"
Text="Passwords should contain a minimum of 7 characters with at least one numeric
character." ValidationExpression="^(?=.*d{1})(?=.*[a-zA-Z]{2}).{7,}$"
ValidationGroup="passwordValidation" Display="Dynamic"></asp:RegularExpressionValidator>
If I type in a password like test1234, it passes in chrome and firefox, but the message that my password should contain a minimum of 7 characters with at least one numeric character is shown in internet explorer
View 1 Replies
Jul 14, 2010
I have used a dll named MARCEngine, which is used to read Marc data. I use a method named MARC2MARC21XML which converts a normal marc file to an XML file.
The problem is it works great on my local IIS, but when I upload it to the production server, it only generates the root node and not the child nodes.
Here is a snippet of my sample page :
[Code]....
Asp.net has the permissions to access the files geneated.
View 1 Replies
Jan 20, 2010
We have an asp.net web service running on Windows Small Business Server 2008 SP2 (64-bit). It is in its own application pool. We've tried both Integrated and Classic settings for Managed Pipeline Mode. Enable 32-bit Applications is set to True. It is not able to successfully call a vb6 dll method but a Windows Forms app on the same machine can.Two vb6 dlls (A and B) are instantiated. The method in A is passed a reference to B as one of its parameters. That method then calls other methods within itself that also require the reference to B.Those internal method calls in A fail with this vb6 error (the A method logs these errors in the Windows Application event log):
70 (Permission Denied)
Another error is also logged in the Windows System event log:
The machine-default permission settings do not grant Local Activation permission for the COM Server application with CLSID {xxx} to the user NT AUTHORITYNETWORK SERVICE SID (S-1-5-20) from address LocalHost (Using LRPC). This security permission can be modified using the Component Services administrative tool.The object in question (a third vb6 component which is an ActiveX EXE) has already been configured using DCOMCNFG (Component Services) with full Launch, Activation, and Access Permissions given to NETWORK SERVICE and even Everyone. Additionally, from Explorer, full control/permissions have been give to all required vb6 components to NETWORK SERVICE (tried Everyone too).
A Windows Forms application on the same machine is able to successfully call the method in A. The same web service works on another machine with a 32-bit OS.Both the web service and the Forms app have been built with Platform Target set to "x86".How can we get the web service call to work on the 64-bit machine?
View 1 Replies
Jan 23, 2011
problem with Stream.Write() where it works under a dev (Windows 7) environment but fails under a server environment (Windows 2008 R2 Enterprise)?
I'm basically working with some third party code which reads from a FileStream and writing to an Http request, nothing unusual and it's doing the following things:
Ensuring that Response.KeepAlive is false (was originally true but worked W7 and not W2K8 so tried false but it doesn't );
Ensuring that the Write includes the length of the bytes to write;
Ensuring that I Flush the stream afterwards;
The error that I encounter is the rather vague 'The request was aborted: The request was canceled.' with InnerException of 'Cannot close stream until all bytes are written.'. Now, my code works perfectly under Windows 7 so I still suspect that something is actively blocking this writing although I am not sure what, how and where.
One other possibility I wondered about was whether the encoding might be different under Windows Server 2008 R2 as opposed to Windows 7?
Here's a code snippet from the relevant method (a bit convoluted but, disclaimer, I didn't write it :-):
string boundary = string.Concat("-------------------------", DateTime.Now.Ticks.ToString("x", CultureInfo.InvariantCulture));
byte[] boundaryBytes = System.Text.Encoding.UTF8.GetBytes(string.Concat("
--", boundary, "
"));........
View 2 Replies
Dec 7, 2010
I have a solution that has 2 projects in it... Project #1 is a class I created some time back to deal with the basic data connection and passing data back and forth.
The 2nd project is the new current project (web site).
Everything works fine in local mode but after I have compiled Project #1 and created a referance in Project #2 then compiled Project #2 and published to the server...
I am running on Windows 7 64bit, .NET 4.0, Access 2010, SQLExpress (loging only), C#... I have rebuilt Project #1 several times as an x86, AnyCPU, and x64... they all give the same result...
I get the following error when the web site is run.
[Code]....
View 4 Replies
May 28, 2010
I have a TypeConverter (I followed this example to a 'T' ). It works perfectly within a console application but I get the dreaded "Unable to generate code for a value of type 'className'. This error occurred while trying to generate the property value for...".This appears in the Event Viewer as a "HttpParseException" with a description of "A parser error has occurred."
This occurs ONLY if I attempt to set the Property implementing the TypeConverter Attribute from within the ASPX, if I don't set the Property the page loads fine. Trouble is, becuase it is a Parse Error I am having a heck of a time debugging.
Again, this works fine within a console app, but only fials when used within an aspx app.
View 2 Replies
Mar 4, 2011
I just bought an old domain name and am looking to redirect as many old URLs as possible to acquire backlinks intended for the original owner for pagerank reasons. The original site had a lot of static pages ending in .htm which need to be redirected to directories. I use httpcontext in my Global.asax file to initiate 301 redirects and this works great on folder names or .aspx files, but whenever I try to redirect a .htm it fails.
Sample code:
if (HttpContext.Current.Request.Url.ToString().ToLower().Contains("http://www.example.com/oldpage.htm"))
{
HttpContext.Current.Response.Status = "301 Moved Permanently";[code]....
I also tried using my Parallels H-Sphere interface provided by my hosting company to do a IIS redirect, but whenever I hit submit the page just starts an infinate loop of sending a request.
View 7 Replies
Nov 8, 2010
Locally I have the cascading dropdown which loads countries in a cascading dropdown working.
But as soon as I place the code on the hosting server, Firebug shows me an:
500 Internal Server Error - [URL]
The cascading dropdown just shows "[Method error 500]"
REMEMBER: IT WORKS ON MY LOCAL SERVER!!!
local configuration:
Windows 7
IIS7.5
ASP.NET4
server configuration:
Windows Server 2008
IIS7.5
ASP.NET4
So it almost MUST be something on my hosting server! :s I dont know what to configure though...
[code]....
View 5 Replies
Feb 23, 2011
Recently for a class to implement unit test for one of its private methods I used PrivateObject by creating private accessor instead of refelection, to which i received a code review comment as below
"My main concern with Private Object is the use of object[] in constructor. It replaces strong typing enforced by compiler with JavaScript-style run-time error detection.Consequently , personally, I would not recommend it."
Comments above confused me beacuse as per my understanding reflection also needs the object[] to invoke any method.
View 2 Replies
Jan 18, 2011
am working as a web developer in a company. I am not aware of anything related to testing. Our company is planning to buy some testing softwares. Presently we are working on ASP.NET. We will be working on PHP and JAVA in future. I need your help to find out the best but cost effective testing sofwares.on TFS and Visual Studio Testing tool.
View 2 Replies
Oct 27, 2010
I'm currently building a .net web application that uses WCF web services to allow a Flex front end to access the database.
I'm in the process of setting up some unit/integration style testing on the web services and am trying to work out the best way to allow the tests to access and modify data in a separate test database.
Currently, the connection string in my unit test project points to my testing database, and the connection string in my web services project points to my development database. However, as I am using Linq it appears that when I call the web service methods from my test class, it uses the development database connection string. I have looked into creating mock objects or in-memory database but I believe the same issue would occur.
Is there a way to get this to work, or is my entire idea about what I want incorrect, in which case is there a better way to set this up?
View 3 Replies
Jan 20, 2011
I'm very new to asp and vb.net, I've just learned about regular expression validation but one thing is bugging me: How can I hide my expression from being viewed on my source code?
The plan is to make a very simple 'login' type of page. I know this goes against all that is holy in this kind of operations, but it's just something I'd like to try out.
Also, after the expression has been validated, I want to load another page, I was thinking of achieving this with:
<asp:TextBox ID="txtcp" runat="server"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="CP Errada"
Display="Dynamic" ControlToValidate="txtcp" ValidationExpression="admin"></asp:RegularExpressionValidator>
and in vb:
If txtcp is validated then Response.Redirect("mypage.aspx") end if
But the syntax on this IF is obviously not right
View 1 Replies
Dec 30, 2010
i have this ValidationExpression="(d{1,}.{0,2} .{2,})|(.{2,} d{1,}.{0,2})" used in regularexpression validator. I want to use the same one in a customvalidator. But customvalidator does not have option validationexpression. how can i add this in code or in tag.
View 1 Replies
Oct 6, 2010
To me this should be much easier, but I can't seem to retain the values that are put in the Insert template upon a validation failure or when the sql fails. This will prevent the user from having to retype everything agin in the event of a failure.
As you can see I am using the Sub Insert_Click and not using an insert through the wizard. so the fields are unbound textboxes on the form. There are 2 dropdowns that provide choices for the other fields.
I pasted in the code using the text only option becuase the format was getting messed up. I probably need more background on why the fields are blanking out.
[code]....
View 8 Replies
Jul 3, 2010
I am using the expression to test for numbers and letters, what do I need to add to also text for "no spaces"?
View 3 Replies
Jun 8, 2010
I'm trying to implement a RequiredFieldValidator with a ValidationExpression which is fail validation if the value is -I'm guessing there will probably be a very simple RegEx for it but I am still trying to get my head around it.
View 7 Replies
May 11, 2010
Using a RegularExpressionValidator, I want my textbox to accept a max of 20 chars, and only English characters A-Z (upper and lowercase), 0-9, hyphens (-), underscores (_), and spaces. That's it.
Now that I think about it, since this text will be used by a proprietary software to create a file of the same name, and will also be included in the querystring when the page is redirected (so that I can find the file so the user can download it), I'm not sure if I should keep it safe and not accept spaces.
View 4 Replies
Sep 17, 2010
I have a text field where user can enter either an URL or an Email address. How can I use a RegularExpressionValidator to validate that user have entered an URL or an Email address
View 8 Replies
Dec 8, 2010
I had a question on here for a RegularExpressionValidator which I'm relatively new to. It was to accept all alphanumeric, apostrophe, hyphen, underscore, space, ampersand, comma, parentheses, full stop. The answer I was given was:
"^([a-zA-Z0-9 '-_&,().])+$"
This seemed good at first but it seems to accept amoung other things '*'.
View 4 Replies
Apr 26, 2010
I am trying to use the RegularExpressionValidator Control in Visual Studio to validate a textbox for email address expressions.
Here's my code (very basic)
Email:
<input id="Text1" type="text" /><br />
<br />
<input id="Validate" type="button" value="Validate" runat="server" /><br />
<br />
[Code]....
I have tried the same mechanism before and have worked; however, this time I am on a new machine, WinXP Pro running IIS v5.1.
View 2 Replies