473,394 Members | 1,870 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,394 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 1924
"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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.