gpt4 book ai didi

silverlight - Silverlight 5 RIA 服务验证与事件目录的示例

转载 作者:行者123 更新时间:2023-12-04 05:56:03 25 4
gpt4 key购买 nike

就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用资料或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the help center寻求指导。




9年前关闭。




我正在寻找具有事件目录身份验证的 Silverlight 5 RIA 服务的示例,

可以下载并且有效

提前致谢。

最佳答案

我还没有找到完整的可下载示例。最简单的方法是创建一个新的 Silverlight 业务应用程序,然后对指定的 3 个文件(Web.config、App.xaml.cs、User.cs)进行以下更改:

应用程序.xaml.cs

  • 注释掉(或删除)以下行:

    //webContext.Authentication = new FormsAuthentication();
  • 取消注释以下行:

    webContext.Authentication = new WindowsAuthentication();

  • 用户.cs
  • 将 [ProfileUsage...] 语句添加到公共(public)部分类用户,使其如下所示:

  • 公共(public)部分类用户:UserBase
    {
    [ProfileUsage(IsExcluded=true)] ///NEEDED FOR WINDOWS/ACTIVE DIRECTORY LOGON
    public string FriendlyName { get; set; }
    }

    网络配置:

    注释掉(或删除)以下行:
    <!--<authentication mode="Forms">
    <forms name=".AuthenticationTest_ASPXAUTH" timeout="2880" />
    </authentication>-->

    取消注释以下行:
    <authentication mode="Windows"/>

    注释掉(或删除)以下行:
        <!--<roleManager enabled="true" defaultProvider="DefaultRoleProvider">
    <providers>
    <clear />
    <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />
    <add name="DefaultRoleProvider" type="System.Web.Providers.DefaultRoleProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" />
    </providers>
    </roleManager>
    <profile defaultProvider="DefaultProfileProvider">
    <properties>
    <add name="FriendlyName" />
    </properties>
    <providers>
    <add name="DefaultProfileProvider" type="System.Web.Providers.DefaultProfileProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" />
    </providers>
    </profile>
    <membership defaultProvider="DefaultMembershipProvider">
    <providers>
    <add name="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
    </providers>
    </membership>
    <sessionState mode="InProc" customProvider="DefaultSessionProvider">
    <providers>
    <add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" />
    </providers>
    </sessionState>-->

    <!--<system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
    </system.serviceModel>-->

    Add the following lines:

    <system.serviceModel>
    <bindings>
    <basicHttpBinding>
    <binding name="winAuthBasicHTTPBinding">
    <security mode="TransportCredentialOnly">
    <transport clientCredentialType="Ntlm"/>
    </security>
    </binding>
    </basicHttpBinding>
    </bindings>
    <behaviors>
    <serviceBehaviors>
    <behavior name="AuthenticationTest.Web.AuthenticationServiceBehavior">
    <serviceMetadata httpGetEnabled="true"/>
    <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>
    </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
    <services>
    <service behaviorConfiguration="AuthenticationTest.Web.AuthenticationServiceBehavior" name="System.Web.ApplicationServices.AuthenticationService">
    <endpoint address=""
    binding="basicHttpBinding"
    bindingConfiguration="winAuthBasicHTTPBinding"
    contract="System.Web.ApplicationServices.AuthenticationService">
    </endpoint>
    </service>
    </services>
    </system.serviceModel>

    关于silverlight - Silverlight 5 RIA 服务验证与事件目录的示例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9499725/

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