whatsthehampton
Programmer
Dear all,
I am bringing out my roles in my global.asax like so:-
But this is hitting the database on every page request.
How can I issue a cookie or ticket to store these roles please?
I have looked all over the place but am having trouble with a formsAuthentication ticket accepting my 'rolelistarray'
All help most appreciated
Regards,
j
I am bringing out my roles in my global.asax like so:-
Code:
Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs)
If Request.IsAuthenticated Then
Dim _cnn As SqlConnection
_cnn = New SqlConnection(BST.JBXEL.DataManager.constr)
Dim cmd As SqlCommand = New SqlCommand("BST_sp_GetUserRoles", _cnn)
cmd.CommandType = CommandType.StoredProcedure
Dim paramUserID As New SqlParameter("@userid", SqlDbType.Int)
paramUserID.Value = HttpContext.Current.User.Identity.Name
cmd.Parameters.Add(paramUserID)
_cnn.Open()
Dim dr As SqlDataReader = cmd.ExecuteReader(CommandBehavior.CloseConnection)
Dim roleList As New ArrayList
Do While dr.Read()
roleList.Add(dr("RGroupName"))
Loop
Dim roleListArray As String() = roleList.ToArray(GetType(String))
HttpContext.Current.User = _
New GenericPrincipal(User.Identity, roleListArray)
_cnn.Close()
End If
End Sub
But this is hitting the database on every page request.
How can I issue a cookie or ticket to store these roles please?
I have looked all over the place but am having trouble with a formsAuthentication ticket accepting my 'rolelistarray'
All help most appreciated
Regards,
j