Select方法必须返回“IQueryable”或“IEnumerable”之一

时间:2014-08-01 01:10:52

标签: c# asp.net owin

从Dotnet.OpenAuth升级到Microsoft OWIN Authentication / OpenAuth2后,当我尝试访问登录页面时出现此错误。

  

当ItemType设置为“Microsoft.AspNet.Membership.OpenAuth.ProviderDetails”时,Select方法必须返回“IQueryable”或“IEnumerable”或“Microsoft.AspNet.Membership.OpenAuth.ProviderDetails”之一。

Visual Studio 2013 ASP.NET C#

什么可能导致此错误?

这是从OpenAuthProviders.ascx.cs抛出错误的行:

 public IEnumerable<string> GetProviderNames()
    {
        return Context.GetOwinContext().Authentication.GetExternalAuthenticationTypes().Select(t => t.AuthenticationType);
    }

这是 OpenAuthProvider.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="OpenAuthProviders.ascx.cs" Inherits="QuoteHD.Account.OpenAuthProviders" %>

<fieldset class="open-auth-providers">
    <asp:ListView runat="server" ID="providerDetails" ItemType="Microsoft.AspNet.Membership.OpenAuth.ProviderDetails"
        SelectMethod="GetProviderNames" ViewStateMode="Disabled">
        <ItemTemplate>
            <button type="submit" class="socialLoginButton <%#: Item.ProviderName %>" name="provider" value="<%#: Item.ProviderName %>"
                title="Log in using your <%#: Item.ProviderDisplayName %> account.">
                <%#: Item.ProviderDisplayName %>
            </button>
            <br /><br />
        </ItemTemplate>

        <EmptyDataTemplate>
            <div class="message-info">
                <p>There are no external authentication services configured. See <a href="http://go.microsoft.com/fwlink/?LinkId=252803">this article</a> for details on setting up this ASP.NET application to support logging in via external services.</p>
            </div>
        </EmptyDataTemplate>
    </asp:ListView>
</fieldset>

0 个答案:

没有答案