G
Guest
Can someone please tell me how I edit this code so it works with an OleDB...
Thanks
Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As
EventArgs)
' Fires upon attempting to authenticate the use
If Request.IsAuthenticated Then
'Determine this user's roles
Dim reader As OleDbDataReader
reader =
SqlHelper.ExecuteReader(ConfigurationSettings.AppSettings("strConn"),
CommandType.StoredProcedure, "rolesForUser", New OleDbParameter("@Username",
User.Identity.Name))
' Create an array of role names
Dim roleList As New ArrayList
Do While reader.Read()
roleList.Add(reader("Name"))
Loop
reader.Close()
'Convert the roleList ArrayList to a String array
Dim roleListArray As String() = roleList.ToArray(GetType(String))
'Add the roles to the User Principal
HttpContext.Current.User = _
New
System.Security.Principal.GenericPrincipal(User.Identity, roleListArray)
End If
End Sub
Thanks
Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As
EventArgs)
' Fires upon attempting to authenticate the use
If Request.IsAuthenticated Then
'Determine this user's roles
Dim reader As OleDbDataReader
reader =
SqlHelper.ExecuteReader(ConfigurationSettings.AppSettings("strConn"),
CommandType.StoredProcedure, "rolesForUser", New OleDbParameter("@Username",
User.Identity.Name))
' Create an array of role names
Dim roleList As New ArrayList
Do While reader.Read()
roleList.Add(reader("Name"))
Loop
reader.Close()
'Convert the roleList ArrayList to a String array
Dim roleListArray As String() = roleList.ToArray(GetType(String))
'Add the roles to the User Principal
HttpContext.Current.User = _
New
System.Security.Principal.GenericPrincipal(User.Identity, roleListArray)
End If
End Sub