Revision: 57038
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at May 8, 2012 06:19 by MSISnippets
Initial Code
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
' Validate Querystrings
' Set raw querystring values to local variables, by definition,
' these are strings.
Dim RawSubjectID As String = Request.QueryString("SubjectID")
Dim RawGroupID As String = Request.QueryString("GroupID")
Dim RawTypeID As String = Request.QueryString("TypeID")
' Check for empty string values (querystring value not passed) and
' validate the expected data type:
' Array: IsArray(<obj to validate>)
' Date: IsDate(<obj to validate>)
' Integer: Int32.TryParse(<value to parse>, <variable to set if successful)
'
If (Not String.IsNullOrEmpty(RawSubjectID) And Int32.TryParse(RawSubjectID, SubjectID)) And _
(Not String.IsNullOrEmpty(RawGroupID) And Int32.TryParse(RawGroupID, GroupID)) And _
(Not String.IsNullOrEmpty(RawSubjectID) And Int32.TryParse(RawTypeID, TypeID)) Then
' Querysting validated, add code here...
End If
End Sub
Initial URL
Initial Description
Initial Title
Querystring Validation
Initial Tags
Initial Language
VB.NET