使用 SimpleMembership,您可以向外部身份验证提供程序按钮添加一个图标,如下所示:
简单会员:
Dictionary<string, object> FacebooksocialData = new Dictionary<string, object>();
FacebooksocialData.Add("Icon", "/content/images/gui/loginFacebook.png");
OAuthWebSecurity.RegisterFacebookClient(
appId: "x",
appSecret: "x",
displayName: "Facebook",
extraData: FacebooksocialData);
然后在您的视图中像这样显示它们:
@foreach (AuthenticationClientData p in Model)
{
<button class="externalLoginService" style="cursor:pointer;color:transparent;border:none;background:url(@p.ExtraData["Icon"]);width:94px;height:93px;margin-right:20px;" type="submit" name="provider" value="@p.AuthenticationClient.ProviderName" title="Log in with @p.DisplayName">@p.DisplayName</button>
}
ASP.NET 身份(?):
app.UseFacebookAuthentication(
appId: "x",
appSecret: "x");
如何使用 ASP.NET Identity(控制器和视图)实现相同的目标?