Big picture question: Authentication modes and startup objects
I have not had to give this much thought till now. I've been writing a fairly conventional Windows app (Vb.net 2005) and I've been using My.User.Name for display purposes. I've taken Windows Authentication for granted. Recently I was forced to modify the program to start up from Sub Main in a module and suddenly My.User.Name is blank.I've been able to work around this as follows: Dim w As System.Security.Principal.WindowsIdentity Dim n as string w = System.Security.Principal.WindowsIdentity.GetCurrent n = w.NameThis appears to work but at the risk of sounding like a beginner, what just happened? 1 person needs an answerI do too
July 6th, 2010 6:50pm

Dim declares a variable with local scope. You either need to declare it as global (Public) or else pass it to your sub as a parameter.http://en.allexperts.com/q/Visual-Basic-1048/vb-net-global-variables.htmOr use a decent language.
Free Windows Admin Tool Kit Click here and download it now
July 6th, 2010 7:40pm

??? That's not my question. I was wondering why changing startup objects gave me problems with the My.User object.
July 6th, 2010 8:41pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics