Translating VB.NET-code into C#.NET + ASP.NET
From: Sjakie (Sjakie_at_discussions.microsoft.com)
Date: 08/07/04
- Next message: /* frank */: "FreshUI: policies per-user basis"
- Previous message: Juan: "Re: Need to Edit the Registry"
- Next in thread: M. Rajesh: "RE: Translating VB.NET-code into C#.NET + ASP.NET"
- Reply: M. Rajesh: "RE: Translating VB.NET-code into C#.NET + ASP.NET"
- Reply: Mike Bright MSP: "Re: Translating VB.NET-code into C#.NET + ASP.NET"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Sat, 7 Aug 2004 02:55:01 -0700
This is the code I like to see translated in C#, but I can't do it myself.
Can somebody help me with this one??
Sub Application_AuthenticateRequest(sender As Object, e As EventArgs)
If Request.IsAuthenticated Then
'Determine this user's roles
Dim reader As SqlDataReader = _
SqlHelper.ExecuteReader(connection string, _
CommandType.StoredProcedure, "rolesForUser", _
New SqlParameter("@Username", User.Identity.Name))
' Create an array of role names
Dim roleList As New ArrayList
Do While reader.Read()
roleList.Add(reader("Name"))
Loop
'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 GenericPrincipal(User.Identity, roleListArray)
End If
End Sub
Thanx
- Next message: /* frank */: "FreshUI: policies per-user basis"
- Previous message: Juan: "Re: Need to Edit the Registry"
- Next in thread: M. Rajesh: "RE: Translating VB.NET-code into C#.NET + ASP.NET"
- Reply: M. Rajesh: "RE: Translating VB.NET-code into C#.NET + ASP.NET"
- Reply: Mike Bright MSP: "Re: Translating VB.NET-code into C#.NET + ASP.NET"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]