Search code examples
silverlightasp.net-3.5

how can i get current user name in Silverlight 2.0


Hi guys i m making one asp.net project with silverlight2.0 .But i cannot get current user name... how can i get current user name thanks...


Solution

  • I basically handle this in one of two ways.

    1) Use the ASP.NET Silverlight control. When the server control loads, grab the current user name using HttpContext.Current.User.Identity.Name and send it in as an InitParam into the silverlight control.

    2) I generally only need the user name when I call back to the server. If the service requires windows authentication, you can just call HttpContext.Current.User.Identity.Name inside the service to get the user name