Asp.net mvc 4 Facebook和Twitter未显示在MVC4默认模板上
我看到很多文章在MVC4默认模板和VisualStudio2012上有Face book和Twitter处理程序。但在我的模板中没有。那么,默认情况下,我应该如何启用它呢Asp.net mvc 4 Facebook和Twitter未显示在MVC4默认模板上,asp.net-mvc-4,visual-studio-2012,Asp.net Mvc 4,Visual Studio 2012,我看到很多文章在MVC4默认模板和VisualStudio2012上有Face book和Twitter处理程序。但在我的模板中没有。那么,默认情况下,我应该如何启用它呢 更新:实际上我不需要知道OAuth的实现。我只需要知道默认模板是否包含上述Facebook和Twitter的UI组件(红色) 您需要在App\u code/AuthConfig.cs文件中取消对Facebook和Twitter的OAuth身份验证的注释。一旦你这样做了,你就需要在Facebook上注册你的应用程序来获取安全密
更新:实际上我不需要知道OAuth的实现。我只需要知道默认模板是否包含上述Facebook和Twitter的UI组件(红色) 您需要在
App\u code/AuthConfig.cs
文件中取消对Facebook和Twitter的OAuth身份验证的注释。一旦你这样做了,你就需要在Facebook上注册你的应用程序来获取安全密钥。一旦你这样做了,你应该能够使用Facebook和/或Twitter作为身份验证服务
AuthConfig.cs如下所示:
public static class AuthConfig
{
public static void RegisterAuth()
{
// To let users of this site log in using their accounts from other sites such as Microsoft, Facebook, and Twitter,
// you must update this site. For more information visit http://go.microsoft.com/fwlink/?LinkID=252166
//OAuthWebSecurity.RegisterMicrosoftClient(
// clientId: "",
// clientSecret: "");
OAuthWebSecurity.RegisterTwitterClient(
consumerKey: "",
consumerSecret: "");
OAuthWebSecurity.RegisterFacebookClient(
appId: "",
appSecret: "");
//OAuthWebSecurity.RegisterGoogleClient();
}
}
除此之外,请看这篇CodeProject文章,它将指导在MVC4中使用OAuth的整个过程:
更新:如果是您的更新,我的答案不太可能是解决方案。您给了我比我期望的更多的信息。但我的问题是MVC 4默认模板在我的图像上显示face book或twitter UI图像(红色)?