【问题标题】:WCF AuthenticationService.IsLoggedIn problemWCF AuthenticationService.IsLoggedIn 问题
【发布时间】:2010-11-22 09:40:25
【问题描述】:

我对身份验证例程使用单独的 WCF AuthenticationService。方法:ValidateUser,Login return true,所以看起来一切正常,但是当我在使用 Login() 方法后调用 IsLoggedIn() 时,它返回 false。

AuthService 设置:

 <?xml version="1.0"?>
 <configuration>




    <connectionStrings>
     <clear />
    <add name="LocalMySqlServer" connectionString="server=192.168.0.7;Database=clients;       uid=clients;pwd=fetisova;persist security info=True;CharSet=utf8;         Use Procedure Bodies =false;" providerName="MySql.Data.MySqlClient" />
     </connectionStrings>


<system.web>
<machineKey validation="SHA1" />
<compilation debug="true" targetFramework="4.0" />
<authentication mode="Forms" >
  <forms cookieless="UseCookies" />
</authentication>

<membership defaultProvider="MySQLMembershipProvider">
    <providers>
      <clear />
      <add name="MySQLMembershipProvider" 
           type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web, Version=6.1.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" 
           connectionStringName="LocalMySqlServer" 
           enablePasswordRetrieval="false" 
           enablePasswordReset="true" 
           requiresQuestionAndAnswer="false" 
           applicationName="Clients" 
           requiresUniqueEmail="false" 
           passwordFormat="Hashed" 
           maxInvalidPasswordAttempts="500" 
           minRequiredPasswordLength="3" 
           minRequiredNonalphanumericCharacters="0" 
           passwordAttemptWindow="10" 
           passwordStrengthRegularExpression="" />
    </providers>
  </membership>
  <roleManager defaultProvider="MySQLRoleProvider" enabled="true">
    <providers>
      <clear />
      <add name="MySQLRoleProvider" 
           connectionStringName="LocalMySqlServer" 
           applicationName="Clients" 
           type="MySql.Web.Security.MySQLRoleProvider, MySql.Web, Version=6.1.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
    </providers>
  </roleManager>
    </system.web>
   <system.web.extensions>
<scripting>
  <webServices>
    <authenticationService enabled="true"/>
  </webServices>
</scripting>
 </system.web.extensions>
 <system.serviceModel>
<services>
  <service name="System.Web.ApplicationServices.AuthenticationService"
      behaviorConfiguration="AuthenticationServiceTypeBehaviors">
    <endpoint contract=
    "System.Web.ApplicationServices.AuthenticationService"
      binding="basicHttpBinding"
      bindingConfiguration="userHttps"
      bindingNamespace="http://asp.net/ApplicationServices/v200"/>
  </service>
</services>
<bindings>
  <basicHttpBinding>
    <binding name="userHttps">
      <security mode="None" />
    </binding>
  </basicHttpBinding>
</bindings>
<behaviors>
  <serviceBehaviors>
    <behavior name="AuthenticationServiceTypeBehaviors">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug
        httpHelpPageEnabled="true"
        includeExceptionDetailInFaults="true"
      />

    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment
  aspNetCompatibilityEnabled="true"/>

那怎么了?你能帮帮我吗?

【问题讨论】:

  • 你为什么不使用 User.Identity.IsAuthenticated 来代替?
  • 因为它是假的。我不在我的 aspnet 应用程序中验证用户身份。我使用单独的 wcf 服务(身份验证服务)来做到这一点。

标签: c# asp.net wcf authentication


【解决方案1】:

我应该在客户端设置allowCookie="true"

【讨论】:

    猜你喜欢
    • 2010-12-09
    • 2011-05-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-19
    • 2012-07-19
    相关资源
    最近更新 更多