User.InitializeWithWindowsUser Método
Definição
Define e entidade de segurança atual do thread para o usuário do Windows que iniciou o aplicativo.Sets the thread's current principal to the Windows user that started the application.
public:
void InitializeWithWindowsUser();
public void InitializeWithWindowsUser ();
member this.InitializeWithWindowsUser : unit -> unit
Public Sub InitializeWithWindowsUser ()
Comentários
Você pode usar o My.User.InitializeWithWindowsUser método para definir a entidade de segurança atual do thread para o usuário do Windows que iniciou o aplicativo.You can use the My.User.InitializeWithWindowsUser method to set the thread's current principal to the Windows user that started the application. O modelo de aplicativo Visual Basic em um aplicativo do Windows chama esse método na inicialização por padrão.The Visual Basic Application Model in a Windows application calls this method at startup by default. Em outros tipos de projeto, você deve definir a entidade de segurança atual do thread chamando esse método explicitamente ou atribuindo um valor a Thread.CurrentPrincipal .In other project types, you must set the thread's current principal by calling this method explicitly or by assigning a value to Thread.CurrentPrincipal.
Em projetos do Windows, o My.User objeto é baseado na entidade atual do thread; portanto, esse método pode alterar as informações My.User retornadas.In Windows projects, the My.User object is based on the thread's current principal; therefore, this method can change the information My.User returns. Em um aplicativo ASP.NET, o My.User objeto é baseado na identidade do usuário da solicitação HTTP atual e não é afetado por esse método.In an ASP.NET application, the My.User object is based on the current HTTP request's user identity, and is unaffected by this method.
Observação
O comportamento exato do My.User objeto depende do tipo de aplicativo e do sistema operacional no qual o aplicativo é executado.The exact behavior of the My.User object depends on the type of application and on the operating system on which the application runs. Para obter mais informações, consulte a User visão geral da classe.For more information, see the User class overview.
Este é um membro avançado; Ele não aparecerá no IntelliSense, a menos que você clique na guia tudo .This is an advanced member; it does not show in IntelliSense unless you click the All tab.
Disponibilidade por tipo de projetoAvailability by Project Type
| Tipo de projetoProject type | DisponívelAvailable |
|---|---|
| Aplicativo do WindowsWindows Application | SimYes |
| Biblioteca de ClassesClass Library | SimYes |
| Aplicativo do ConsoleConsole Application | SimYes |
| Biblioteca de controle do WindowsWindows Control Library | SimYes |
| Biblioteca de controle da WebWeb Control Library | SimYes |
| Serviço do WindowsWindows Service | SimYes |
| SiteWeb Site | SimYes |