I am having a problem with accesing function in the page. i have a page say user.aspx in the page load method
i am calling function to validate the user.
it works fine when single user access the page but when another user try to access the page then it crash the
first users processing and empty the session variable.
means when i am calling function in the page load of user.aspx then it is giving me problem.
and if i write user validation code direct in page load method then it works fine.
problem occurs only when i write user validation code in function and try to call that function in page load of
user.aspx
Expand|Select|Wrap|Line Numbers
- Private Sub Page_Load
- IF validateUser() THEN
- Response.write ("Welcome" & sUserID )
- Else
- Response.Redirect("UserNotFound.aspx?userid=" & sUserID & "&Form=DataXS")
- End If
- End sub
- Public Function validateUser() as boolean
- Dim dbOleDbDataReader As OleDbDataReader
- dim bflag as boolen
- sSQL = "Select NAME From kuaf where lower(NAME)='" & LCase(sUserID) & "'
- Dim sConnectionString As String = xsData.getDatabaseConnection(sLogFile)
- Using dbConnection As New OleDbConnection(sConnectionString)
- Dim dbcommand As New OleDbCommand(sSQL, dbConnection)
- dbcommand.CommandType = CommandType.Text
- dbcommand.Connection.Open()
- dbOleDbDataReader = dbcommand.ExecuteReader()
- If Not dbOleDbDataReader Is Nothing Then
- If dbOleDbDataReader.Read() Then
- bflag = True
- Else
- Response.Redirect("UserNotFound.aspx?userid=" & sUserID & "&Form=DataXS")
- End If
- End If
- dbOleDbDataReader.Close()
- dbOleDbDataReader = Nothing
- dbcommand.Dispose()
- dbcommand = Nothing
- dbConnection.Close()
- End Using
- Return bflag
- End Function
Thanks
-Joseph