Get current Windows user name within Silverlight

前端 未结 8 1780
一向
一向 2020-12-02 23:53

Is it possible to get the currently logged in user\'s username with Silverlight? You can assume that user has Windows OS and the Silverlight application is hosted in Interne

8条回答
  •  执笔经年
    2020-12-03 00:05

    // a small improvement of Code Maverick answer using System.IO.Path.DirectorySeparatorChar rather // then //

    Environment .GetFolderPath(Environment.SpecialFolder.Personal) .Split(new[] { System.IO.Path.DirectorySeparatorChar }, StringSplitOptions.RemoveEmptyEntries)[2];

提交回复
热议问题