473,387 Members | 1,904 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Re: How to obtain current credentials?

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
Jul 10 '08 #1
2 2306
"K Viltersten" <tm**@viltersten.comwrote:
How would you express the same hint in C#?
using System.Security.Principal;

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

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

Eq.
Jul 10 '08 #2
>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
Jul 11 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jamie | last post by:
I'm trying to create a HttpWebRequest object that uses the current logged in users credentials. The site is using Windows Authentication, Anonymous access is turned off. Will the HttpWebRequest...
15
by: SFX | last post by:
If I have a session ID (string) can I somehow obtain the session object associated to that ID (it exist of course) ? I know this sounds wicked but I have a situation in which I have to make a...
3
by: cmrchs | last post by:
Hi, I try to obtain the current culture of a server by executing : string str = Thread.CurrentThread.CurrentCulture.ToString(); Executing this in a console-applicastion results in the...
2
by: **Developer** | last post by:
THIS IS WHAT I DO: Dim lG As Graphics = pD.PrinterSettings.CreateMeasurementGraphics() Dim lHdc As IntPtr = lG.GetHdc() leftOffsetP = GetDeviceCaps(lHdc, PHYSICALOFFSETX) topOffsetP =...
1
by: VictorG | last post by:
Hello, The below C# code works fine in obtaining the windows user's account SID when the user is local to the machine. It throws a "Not Found" exception when trying top obtain the SID for a...
3
by: ssg31415926 | last post by:
I'm getting the error: "Unable to open the Web 'http://blah/blahblah'. You are not authorized to perform the current operation". I have changed a few things recently but I can't change them back...
2
by: ME | last post by:
How would one obtain the parameter VALUES of a method that has already run? I can find the method using the StackTrace and StackFrame classes but once I find the method I would like to obtain the...
7
by: Brian Cryer | last post by:
What I'm looking for is a way to tell if two sessions are from the same physical PC or from different PCs (within the same organisation say). This is with the view to possibly enforcing license...
2
by: mm3178 | last post by:
Hello Mates, My case is slightly complicated....please help me In order to obtain real time current balance of an account, I have built a c# windows service that invokes a c# web service...
0
by: leonardo.schmidt | last post by:
Due to some connectivity problems with a client's VPN software, I'm developing an app that needs to obtain the current logged user's Exchange server address & add a new route (among other...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.