Click here to Skip to main content
15,915,093 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Trying an Excel Interop Pin
tanstaafl2818-Jun-04 9:09
tanstaafl2818-Jun-04 9:09 
GeneralRe: Trying an Excel Interop Pin
tanstaafl2819-Jun-04 7:23
tanstaafl2819-Jun-04 7:23 
Generallong hyperlink for shellexecute with mailto Pin
skoizumi2911018-Jun-04 7:18
sussskoizumi2911018-Jun-04 7:18 
GeneralTreeView to a ListView Pin
Brad Fackrell18-Jun-04 4:17
Brad Fackrell18-Jun-04 4:17 
GeneralRe: TreeView to a ListView Pin
Dave Kreskowiak18-Jun-04 4:51
mveDave Kreskowiak18-Jun-04 4:51 
GeneralRe: TreeView to a ListView Pin
Brad Fackrell18-Jun-04 5:06
Brad Fackrell18-Jun-04 5:06 
GeneralRe: TreeView to a ListView Pin
Brad Fackrell18-Jun-04 5:29
Brad Fackrell18-Jun-04 5:29 
GeneralAnti SQL Injection Helper Pin
Jim Taylor18-Jun-04 3:55
Jim Taylor18-Jun-04 3:55 
I want to take a belt and braces approach to avoiding SQL injection attacks. First step is to obviously used parameterised stored procedures. The second is to write a helper class to check input meets the expected format. To this end I'm thinking of writing a helper class that uses regular expressions.

<br />
Imports System.Text.RegularExpressions<br />
Public Class AntiSQLInjectionHelper<br />
<br />
    Private Sub New()<br />
    End Sub<br />
<br />
    Public Shared Function CheckString(ByVal Value As String, ByVal [CheckType] As CheckType) As Boolean<br />
        Dim pattern As String<br />
        Select Case [CheckType]<br />
            Case CheckType.DateString 'Checks for accepted date format<br />
                pattern = "TODO"<br />
            Case CheckType.General 'Checks for accepted general format (ie one that doesn't contain any DROP commands etc)<br />
                pattern = "TODO"<br />
            Case CheckType.NumberString 'Checks for accepted number format<br />
                pattern = "TODO"<br />
            Case CheckType.PasswordString 'Checks for accepted password format<br />
                pattern = "TODO"<br />
            Case CheckType.UsernameString 'Checks for accepted username format<br />
                pattern = "TODO"<br />
        End Select<br />
        Return Regex.IsMatch(Value, pattern)<br />
    End Function<br />
<br />
    Public Enum CheckType<br />
        DateString<br />
        NumberString<br />
        UsernameString<br />
        PasswordString<br />
        General<br />
    End Enum<br />
<br />
End Class<br />
<br />


Has anyone out there got a better way / done anything similar, think its a good idea or know of an alternative? I know there are validation controls that use javascript but a dtermined hacker can circumvent them.

Jim
GeneralRe: Anti SQL Injection Helper Pin
Dave Kreskowiak18-Jun-04 4:14
mveDave Kreskowiak18-Jun-04 4:14 
GeneralRe: Anti SQL Injection Helper Pin
Jim Taylor18-Jun-04 8:04
Jim Taylor18-Jun-04 8:04 
GeneralRe: Anti SQL Injection Helper Pin
Steven Campbell18-Jun-04 5:18
Steven Campbell18-Jun-04 5:18 
GeneralRe: Anti SQL Injection Helper Pin
Jim Taylor18-Jun-04 8:10
Jim Taylor18-Jun-04 8:10 
Generalcalendar control Pin
Vicetta18-Jun-04 3:53
Vicetta18-Jun-04 3:53 
GeneralRe: calendar control Pin
Dave Kreskowiak18-Jun-04 4:47
mveDave Kreskowiak18-Jun-04 4:47 
GeneralRe: calendar control Pin
Vicetta18-Jun-04 4:57
Vicetta18-Jun-04 4:57 
GeneralRe: calendar control Pin
Dave Kreskowiak18-Jun-04 5:19
mveDave Kreskowiak18-Jun-04 5:19 
GeneralRe: calendar control Pin
Vicetta21-Jun-04 21:44
Vicetta21-Jun-04 21:44 
GeneralSystemTray Pin
Yoseikan18-Jun-04 3:15
Yoseikan18-Jun-04 3:15 
GeneralRe: SystemTray Pin
Yoseikan18-Jun-04 3:53
Yoseikan18-Jun-04 3:53 
GeneralFolder Browse Dialog Control Pin
mphanides18-Jun-04 0:22
mphanides18-Jun-04 0:22 
GeneralRe: Folder Browse Dialog Control Pin
Dave Kreskowiak18-Jun-04 5:10
mveDave Kreskowiak18-Jun-04 5:10 
GeneralPackage &amp; Deployment wizard Pin
syed saba17-Jun-04 23:59
syed saba17-Jun-04 23:59 
GeneralRe: Package &amp; Deployment wizard Pin
Dave Kreskowiak18-Jun-04 3:26
mveDave Kreskowiak18-Jun-04 3:26 
GeneralRe: Package &amp; Deployment wizard Pin
Ian Darling18-Jun-04 3:47
Ian Darling18-Jun-04 3:47 
GeneralRe: Package &amp; Deployment wizard Pin
Dave Kreskowiak18-Jun-04 4:20
mveDave Kreskowiak18-Jun-04 4:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.