Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/silverlight/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Silverlight业务应用程序Windows身份验证_Windows_Silverlight_Authentication - Fatal编程技术网

Silverlight业务应用程序Windows身份验证

Silverlight业务应用程序Windows身份验证,windows,silverlight,authentication,Windows,Silverlight,Authentication,我似乎无法在Silverlight业务应用程序中使用Windows身份验证 我已进行了必要的更改,请参见下文 在App.xaml中更改为Windows身份验证 public App() { InitializeComponent(); // Create a WebContext and add it to the ApplicationLifetimeObjects // collection. This will then

我似乎无法在Silverlight业务应用程序中使用Windows身份验证

我已进行了必要的更改,请参见下文

在App.xaml中更改为Windows身份验证

    public App()
    {
        InitializeComponent();

        // Create a WebContext and add it to the ApplicationLifetimeObjects
        // collection.  This will then be available as WebContext.Current.
        WebContext webContext = new WebContext();
        //webContext.Authentication = new FormsAuthentication();
        webContext.Authentication = new WindowsAuthentication();
        this.ApplicationLifetimeObjects.Add(webContext);
    }
已在web.config中更改为Windows身份验证

<authentication mode="Windows"/>

<roleManager enabled="true" defaultProvider="AspNetWindowsTokenRoleProvider"/>

谁能告诉我出了什么问题。我根本没有对项目做任何其他更改。

这以前也发生在我身上。事实证明,在Web项目的属性中未启用Silverlight调试。右键单击.Web项目并单击属性。接下来单击Web选项卡并在底部确保选中Silverlight复选框。

您必须在
应用程序启动中有这一行:

WebContext.Current.Authentication.LoadUser(this.Application_UserLoaded, null);

这将在使用Windows身份验证时自动对用户进行身份验证。

您是要使用Active Directory以外的组,还是要自己管理组成员身份?请尝试在web.config文件中禁用匿名用户。但当我需要知道用户名时,我调用了一个wcf服务方法,该方法返回了用户名。
WebContext.Current.Authentication.LoadUser(this.Application_UserLoaded, null);