Handling Null Session variables in VB.Net

Posted by vishalneeraj-24503 under ASP.NET category on | Points: 40 | Views : 224
By approaching below code,we can avoid null values

Make shared function as below:

Public Shared Function Check_Session_Value_Null(ByVal session_value As HttpSessionState,ByVal key_item As String) As String

Dim result As String = string.empty

if session_value(key_item) <> Nothing Then
result = session_value(key_item)
End If

Return result

End Function

And call above function in any method.

Comments or Responses

Login to post response