-4
如何獲取當前在桌面上進行更改的用戶名?一個按鈕?如何獲取當前用戶名 - 在ASP.NET中使用我的代碼
private string GetCurrentUserName()
{
return Utilities.CurrentUsername();
}
公用設施:
public static string CurrentUsername()
{
string[] data = HttpContext.Current.User.Identity.Name.ToString().Split(new char[] { '\\' });
string retVal = data[1];
return retVal;
}
這甚至意味着什麼?您需要澄清更多 – 2009-08-06 17:05:49
FWIW,您可以使用'.Split('\\');'('Split'採用'params char []') – 2009-08-06 17:07:42
我有一個代碼: public static string CurrentUsername() string [] data = HttpContext.Current.User.Identity.Name.ToString()。Split(new char [] {'\\'}); string retVal = data [1]; return retVal; } 我如何在.net上使用這個名稱來獲取當前用戶名,以便在表上進行更改的人員?我應該從.net使用什麼工具? – Yves 2009-08-06 17:07:43