How to obtain current credentials?

K

K Viltersten

According to the example at the following
location, i should use the following code
in order to obtain the current credentials.

Link:
http://msdn.microsoft.com/en-us/lib...sauthenticationconfiguration.credentials.aspx

Code:
FormsAuthenticationCredentials currentCredentials =
formsAuthentication.Credentials;

However, the "formsAuthentication" seems
not to be declared or detected. What is
missing on the site (alternatively, what
did i miss to realize)?!

Regards
Konrad Viltersten
 
L

Lidia

try this:
Imports System.Security.Principal

Public Function currentId() As String
Dim strReturn As String

strReturn = WindowsIdentity.GetCurrent().Name()

'strReturn = User.Identity.Name

Return strReturn

End Function
 
K

K Viltersten

try this:
Imports System.Security.Principal

Public Function currentId() As String
Dim strReturn As String

strReturn = WindowsIdentity.GetCurrent().Name()

'strReturn = User.Identity.Name

Return strReturn

End Function

How would you express the same hint in C#?

Regards
Konrad Viltersten
 
K

K Viltersten

How would you express the same hint in C#?
using System.Security.Principal;

// ...then, within a class...

public string CurrentId()
{
return WindowsIdentity.GetCurrent().Name;
}

Thanks. I should have thought of it myself... :)

Regards
Konrad Viltersten
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,828
Latest member
LauraCastr

Latest Threads

Top