Monday, April 09, 2012 9:50 PM
This is velsamy , i have created a login Website using ASP.NET(C#) , what is the problem means, I have to prevent the special characters in the username textbox also i have tried a way like :
protected void ValidateNoUrls(object sender, ServerValidateEventArgs e)
e.IsValid = !Regex.IsMatch(e.Value, @"(ht|f)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&%\$#_]*)?");
<asp:TextBox ID="TextBox1" runat="server" MaxLength="15" Width="220px" />
<asp:CustomValidator runat="server" OnServerValidate="ValidateNoUrls" ControlToValidate="TextBox1" ErrorMessage="Urls not allowed"/>
While i Triying this code there is a Compiler Error Message: CS0103: The name 'Regex' does not exist in the current context.
So anyone can help me,
Thanks in advance,
- Moved by CoolDadTxMVP, Moderator Tuesday, April 10, 2012 5:05 PM Not IDE related (From:Visual C# IDE)
Tuesday, April 10, 2012 4:07 AM
Have you added reference to below namespace in the code behind?
Assembly: System (in System.dll)
Thursday, April 12, 2012 3:07 AMModerator