Current User's FullName - Exception - ADEntry.Properties("FullName").Value
Sep 4, 2008
Well, when you pull down the start menu in XP it Usually prints your name right at the top of the menu. I believe it's the same name that is in the "Full Name" field of the Add User dialog. However, of course, on my current work computer there is no "local" account, as I'm logged onto a full network, etc, and so I'm going through a domain of some sort. (Don't know too much about that stuff, and frankly don't really care.) However, I did look up and found some information about requesting the full user name. (not just your login user name). For example:
Thomas Thumb logs in as : tthumb
Start menu it says: Thumb, Thomas
Email Account: 99thutho
So in effect to do certain things in my application it is rather imperative to retrieve the current users "Full Name". This is how I am currently doing it:
Dim DomainUser As String = My.User.Name.Replace("", "/")
Dim ADEntry As New System.DirectoryServices.DirectoryEntry("WinNT://" & DomainUser)
_userfull = New NameStruct(ADEntry.Properties("FullName").Value)
Don't both with the NameStruct, it is simply a parser to determine First Name and Last Name. Now the problem with this is that when My computer is not connected to the network I get an Exception at the line: ADEntry.Properties("FullName").Value
Which makes some sense, but also is somewhat amusing, because when I disconnect from the network (and my laptop goes into standby with the lid down so i can take it home), I later open the lid and log back in and everything is the same, so It still has the information of "Thumb, Thomas" on the start bar, even though I'm no longer connected to the current network. So how can i ask this computer, (not some network service) for the current users Full Name.
I am using dotnetopenid in my asp.net 2.0 and VS 2005.I have done only this work and a succeful authentication is done by me.I have a login page and after authentication it goes to food.aspx.I only want to display the email address of user on food.aspx after authentication from google.I have done only following work for the openid nothing else please tell me which code i have to write in login.aspx or food.aspx to display the email address of user.
I have a Windows form.in windows form have a combo box that give me a list of available port serial with it code (Dim ports As String() =SerialPort.GetPortNames())for example( Com1,Com8,Com15,...).but I want to give me fullname of serial port in device manager for example in dvice manager is these (Comunication Port(COM1) - Printer Port(LPT1) And USB Serial Port(COM8)).how to Get it?
I'm making a control and I am trying to finalize my design time properties grid. I have several List(of Class) items as public properties and when I click on the design time menu (while testing the control) there is the word "Collection" and a button with an ellipsis (...) that brings up a neat pop up with the buttons Add/remove and all of the public properties of the collection's class on the right hand side. Basically for a non-collection instance of a class (with public properties) I'd like a similar button to show up. I know I could put all of the properties in the main control class and group them, but I like the pop up box feature. Anyway to duplicate this? (think font grid item etc.)
How to know that if the current user is an administrator or normal user or guest? And how to make the exe can just only run in administrator?
I have tried to set the .manifest to "<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />", but no use. Although I am not logged in as admin, I can still run the exe.
Code will run from frmFacility and will shift into UserControl:
Public Class frmFacility Private primaryBaseDay As Date Private isClassPrimaryView As Boolean = False
[Code].....
At the line If facilityForm.IsOnPrimaryView Then, I get a NullReferenceException. Do you know the reason?
Also, I cannot create a new instance of the facilityForm, since I need to work with its singleton, although when I add a new instance of frmFacility, the IsOnPrimaryMode is set to false while it should be set to true in the gotoday sub from frmFacility.
In my application I have a several type of user could be log in. My purpose is to have a restriction with other menu to show on or off. In php I used a session to handle that user id. In vb.net how can assign user id and retrieve anytime I need it in every user that has been logged in, so that I can check the user type and do some action.
I've created a user control that is basically a Panel that contains 1 label,3 TextBoxes and a few properties that set/get some short integer values.During a form load event I display a number of these Panels.I then access the Panels name (and other panel properties) via a user-created handler for the panel's click eventHowever I would really like to access the values from the user-control's properties.
Public Sub load_Panels() Dim pnlName As String Dim x As Short = 69
Okay, so I wrote a few custom ItemTemplates for VS2010 that implement IWizard in VB.NET (4.0). Straight forward enough. They work during my testing, but when someone else deploys and attempts to use any of them, Visual Studio throws an incredibly generic Exception has been thrown by a target of invocation error.
Stranger still, after they open up the project properties and try again... they work. Without changing anything. Anyone have any clue what is going on? Or perhaps even just a way of getting VS to give me a more specific error? I already tried devenv.exe /log but nothing out of the ordinary was there.
Role Public Class Role Public Property RoleID As Integer Public Property CreatedBy As User
[code]....
The situation is like when we create roles, we will save who created this role. So i have a CreatedBy Property of type User. Similarly when we create a User, we will mention what role the new user belongs to .So i have a property called "Role" of type "Role". This circular reference giving me StackOverflow exception as its recursive when i create an object of User class.How do i handle this ? should i restucture my entties ? how ?
Why am I getitng the following error? Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
I have tried multiple ways of grabbing the username of a current logged on user in vb.net/asp.net. I am running it on IIS 6 and understand that it will return NETWORK SERVICE for the username. I need to grab the username of the actual windows box log on.I have tried the following code: Returns NT AUTHORITYNETWORK SERVICE
Dim User = System.Security.Principal.WindowsIdentity.GetCurrent.User Dim UserName = User.Translate(GetType(System.Security.Principal.NTAccount)).Value
im using membership of asp.net to manage user and roles in my vb.net winform application when logged in i wanna get the current user in a specific form
i use that code
nom = TextBox1.Text Dim user As MembershipUser = Membership.GetUser(nom) Dim identity As New GenericIdentity(user.UserName)
I have a code that works fine to get all users but when I just want the one user it will not except the code it dose not give any errors but nothering will happen in the code you can use more that one agument so this is what i need help with in command prompt if you type net user %username% it will give me my current user account information which is what i am trying to get in my program [code]
i have a couple of questions 1- i have a button when the user click on it the current row in the DGV will be deselected and the next row will be selected.(i know that there is this option in the binding navigator but i need to do it manually.) so how can i do that?
2- i need to make a the first column (unselected) all the time i mean if i click it or moved to it the selection will move to the next column.
i have a problem with my project.in one form i have 2 textboxes in one i have displayed the serial number.in the second i want display the current user logged on software.how can i display the current user logged in ????? the code for the serial number is :[code].....
I've been searching for a while, but it seems that I can't find an easy way to get the current user profile folder. I've tried "%userprofile%" environment variable, but it didn't worked (or I'm doing something wrong).How can I do it? I want to add the value to an string variable.
I actually tried something like: Dim Userfolder As String = %UserProfile%
I tried with quote marks too, but none seems to do the trick.What I'm missing?
i am looking for information on how to get the current active directory users name? Basically i have a recording package program and some of the users have expressed the want to have it track who is entering which notes. So when a note is saved the program will take a look at who is currently logged into the computer and save it to the database. I have found how to do this for mac address, computer name and ip address but have not found anything yet for getting current logged on user.
Dim Process As New Process() Dim Count As Integer = 0 For Each Process In Process.GetProcesses(My.Computer.Name)
[code].....
I have that currently. What I want is instead of it loading ALL processes, I only want it to load processes from the current user. (ie. Ryan or Andrew, not SYSTEM or LOCAL.)'ve done research on Google looking how to implement and I've gotten some code on how to retrieve a User Name of the current user but nothing prevailed for what I needed :[ Any ideas? I'm noobish, taking Computer Science in Fall so I'm preparing and still learning.
This code suppose to take the user's input of current balnace, the annual interest rate, the current month, and amount he/she will pay per month. When the CALCULATE button is clicked the program starting with the current month, should compute and display for each month until the balance is reduced to zero, the month, the interest charge, payment, and new balance. But somehow im stuck in an infinite loop and its not displaying anything.
So I'm making a asp.net login. I want the login name that people use to match an id in my SQL database. So that I can retrieve their information. But currently when I use the code below, from which I get the name of the computer I am currently on. However I would like the user Identity to be what they write in the username textbox at the login screen.
How can I access the current user information via LDAP and VB.Net 2.0*? I found a vbscript that works, but I'd rather have it done in .net
Dim objSysInfo = CreateObject("ADSystemInfo") Dim strUser = objSysInfo.UserName 'returns current user account Dim objUser = GetObject("LDAP://" & strUser) 'queries active directory for user account
I'm using the framework 2.0 because it is for more likely in my XP/Vista/7 World to have 2.0 installed than 3.5 or 4.0