"Francis Shanahan" <fs@NoSpamTodayThanks.francisshanahan.com> wrote in
message news:O7**************@tk2msftngp13.phx.gbl...
I assume you've authenticated with Forms authentication, if not just
replace Forms in this example with Generic.
If Not (HttpContext.Current.User Is Nothing) Then
If (HttpContext.Current.User.Identity.IsAuthenticated ) Then
If (TypeOf HttpContext.Current.User.Identity Is
FormsIdentity) Then
Dim userIdentity As FormsIdentity =
CType(HttpContext.Current.User.Identity, FormsIdentity)
/////////Once you have the userIdentity you can get the username I think.
End If
End If
End If
End Sub
Actually, the following will work:
Dim UserName As String = Nothing
If Not (HttpContext.Current.User Is Nothing) AndAlso _
(HttpContext.Current.User.Identity.IsAuthenticated ) Then
UserName = HttpContext.Current.User.Identity.Name
End If
If you place this code on a web form or user control, you can simply refer
to "Context" instead of "HttpContext.Current", and you can use
Request.IsAuthenticated.
--
John Saunders
Internet Engineer
jo***********@surfcontrol.com