gpt4 book ai didi

Silverlight RIA 服务身份验证事件目录

转载 作者:行者123 更新时间:2023-12-04 06:54:50 26 4
gpt4 key购买 nike

嗨,我是 ria 服务的新手
我正在尝试将登录从 SQL 更改为事件目录并使用登录表单 我正在使用 Silverlight 业务应用程序模板作为基础 我在网站上设置了 ADmembership 提供程序,但我如何让 Silverlight 使用它?

最佳答案

这篇博文给出了答案。 Silverlight with WCF Ria Services and Active Directory Roles .感谢丹的这篇文章!

我正在使用 Silverlight 4,所以自从这篇文章以来,一些事情发生了变化。我还为这个项目使用了业务应用程序模板。

第 1 步。这已经在 App.xaml.cs 代码后面的 BussinessApplication 模板中设置。您确实需要用 webContext.Authentication = new FormsAuthentication(); 注释该行并取消注释该行 webContext.Authentication = new WindowsAuthentication(); .

第 2 步。没有变化。添加 <authentication mode="Windows"/>到/configuration/system.web 元素下的 web.config。

步骤 3. RiaContex 现在是 WebContext,因此在示例中更改它。加载用户的第一行,RiaContext.Current.Authentication.LoadUser(this.Application_UserLoaded, null);已经在代码中了。

第 4 步。没有变化。添加 <roleManager enabled="true" defaultProvider="AspNetWindowsTokenRoleProvider"/>到/configuration/system.web 元素下的 web.config。

通过这些小的更改,Silverlight 应用程序连接到 Active Directory 并填充了 WebContext.Current.User.Roles我正在寻找的。

关于Silverlight RIA 服务身份验证事件目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2679187/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com