0

I need to get the User Name of current Windows Login user. is there any way to do that in silverlight? thanks in advance.

star
  • 41
  • 1
  • 3

1 Answers1

2

Do you use Windows Authentification and asp.net page as host?

So deny anonymous users

<authorization>
    <deny users="?" />
</authorization>

and use this code:

<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
...
    <param name="initParams" value="username=<%= User.Identity.Name %>" />
...
</object>

After that parse input params in the silverlight application:

private void Application_Startup(object sender, StartupEventArgs e)
{
    var username = e.InitParams["username"];
    this.RootVisual = new MainPage();
}

 

Also I know another way to achieve this (with wcf service), but it is more complicated.

Hossein Narimani Rad
  • 31,361
  • 18
  • 86
  • 116
vortexwolf
  • 13,967
  • 2
  • 54
  • 72
  • i very sorry i confused you.What i need is the user name you login your windows system – star Nov 25 '10 at 14:15