Reply
Disable special characters in .asp using vb
Old 03-31-2009, 12:18 PM Disable special characters in .asp using vb
Novice Talker

Posts: 12
Trades: 0
Hi Guys,

is there anyway to disable special chracters in a login form/text box? Characters like these
' \ / " > < = + -

It is a .asp site and uses VB in it?

Many Thanks upfront.
wappoint is offline
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 04-16-2009, 12:12 AM Re: Disable special characters in .asp using vb
Junior Talker

Posts: 1
Name: shuiling
Trades: 0
i want to konw too
shuiling99 is offline
Reply With Quote
View Public Profile
 
Old 06-01-2009, 06:23 AM Re: Disable special characters in .asp using vb
Experienced Talker

Posts: 30
Name: Kulrom
Location: Republic of Macedonia
Trades: 0
You can use RegularExpressionValidator control. Just set the regular expression to accepts number and letters [A-z0-9]
Kulrom is offline
Reply With Quote
View Public Profile Visit Kulrom's homepage!
 
Old 06-01-2009, 08:55 AM Re: Disable special characters in .asp using vb
Novice Talker

Posts: 9
Name: zobin lee
Trades: 0
Code:
  Function ReplaceSpecialLetter(str)
    Dim TmpStr
    TmpStr = Str
    TmpStr = Replace(TmpStr,"'","")
    TmpStr = Replace(TmpStr,"""","")  
    TmpStr = Replace(TmpStr,"/","")
       ......
    ReplaceSpecialLetter = TmpStr
  End Function
dopanel.com is offline
Reply With Quote
View Public Profile
 
Old 06-01-2009, 10:04 AM Re: Disable special characters in .asp using vb
Experienced Talker

Posts: 30
Name: Kulrom
Location: Republic of Macedonia
Trades: 0
dopanel, this will replace all instances (if any) of the forbidden characters which is nto what he needs (i am pretty sure about it).
Imagine you sign up using one of these chars in your username but now your username is not what you expect.
He must prevent the bad characters instead replacing them. As mentioned, RegularExpressionValidator is best way for that.
Kulrom is offline
Reply With Quote
View Public Profile Visit Kulrom's homepage!
 
Old 06-01-2009, 11:44 PM Re: Disable special characters in .asp using vb
Novice Talker

Posts: 9
Name: zobin lee
Trades: 0
Quote:
Originally Posted by Kulrom View Post
dopanel, this will replace all instances (if any) of the forbidden characters which is nto what he needs (i am pretty sure about it).
Imagine you sign up using one of these chars in your username but now your username is not what you expect.
He must prevent the bad characters instead replacing them. As mentioned, RegularExpressionValidator is best way for that.
Hmmmm
My function can't be used in some area,but if the field is like a username ,i think he must using javascript instead to alert the error message ,and user can modify to the correct format.
dopanel.com is offline
Reply With Quote
View Public Profile
 
Old 06-02-2009, 05:02 AM Re: Disable special characters in .asp using vb
Experienced Talker

Posts: 30
Name: Kulrom
Location: Republic of Macedonia
Trades: 0
Exactly ... the RegularExpressionValidator will alert you if the expression doesn't match .. and yes it is using client-side code (javascript) for that. However you don't need to code anything .. just drag and drop and set which control to be validate. Pretty str8 forward!
Kulrom is offline
Reply With Quote
View Public Profile Visit Kulrom's homepage!
 
Old 06-06-2009, 04:31 AM Re: Disable special characters in .asp using vb
harish's Avatar
Average Talker

Posts: 26
Name: Harish kumar
Trades: 0
use that code hope that will help you..

Code:
<%
Dim CATEGORIES
Dim CATEGORIES_cmd
Dim CATEGORIES_numRows
 
Set CATEGORIES_cmd = Server.CreateObject ("ADODB.Command")
CATEGORIES_cmd.ActiveConnection = MM_recrutanet_STRING
CATEGORIES_cmd.CommandText = "SELECT CATEGORY, COUNT(*) as COUNT FROM dbo.JOB GROUP BY CATEGORY ORDER BY COUNT DESC" 
CATEGORIES_cmd.Prepared = true
 
Set CATEGORIES = CATEGORIES_cmd.Execute
CATEGORIES_numRows = 0%>
harish is offline
Reply With Quote
View Public Profile
 
Old 06-06-2009, 06:45 AM Re: Disable special characters in .asp using vb
Experienced Talker

Posts: 30
Name: Kulrom
Location: Republic of Macedonia
Trades: 0
Hi Harish, may we know, how this code prevents the unwanted characters?

It only retrieves the Category from the Job table and has nothing to do with preventing odd chars in a textbox. I've noticed that almost all your posts are non-related to the original question.

Are you gaining posts count or what?
Kulrom is offline
Reply With Quote
View Public Profile Visit Kulrom's homepage!
 
Reply     « Reply to Disable special characters in .asp using vb
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 



Page generated in 0.13607 seconds with 13 queries