Dotnetnuke 错误401非未经授权的linqotitter API

Dotnetnuke 错误401非未经授权的linqotitter API,dotnetnuke,linq-to-twitter,Dotnetnuke,Linq To Twitter,我关注linqtotiwtter.codeplex.com的演示 我试图暂停演示webformrtimeline,因此我为DotNetNuke模块编写了此代码,当为beginauthorization推送底部btnAutorizar时,响应总是错误401Unauthorized。这是我在模块设置中输入的配置 消费市场:lcgG6BXQpwQtHSzwqWA 消费者信用:6MOV8PLLBKTGVAAP5EZDYEHMGCHGEDE8EDUK5MPAS 我在推特上的应用呼叫dnnPrueba 我在

我关注linqtotiwtter.codeplex.com的演示 我试图暂停演示webformrtimeline,因此我为DotNetNuke模块编写了此代码,当为beginauthorization推送底部btnAutorizar时,响应总是错误401Unauthorized。这是我在模块设置中输入的配置

消费市场:lcgG6BXQpwQtHSzwqWA 消费者信用:6MOV8PLLBKTGVAAP5EZDYEHMGCHGEDE8EDUK5MPAS 我在推特上的应用呼叫dnnPrueba

我在代码中的错误是什么??,我还需要什么?请帮帮我!对不起我的英语


公共部分类ViewTwitterAndrea:PortalModuleBase{ 私有配置Witterandrea配置; 私人网络授权人; 受保护的无效页面加载(对象发送方,事件参数e){ 试试{ configuracion=新的ConfiguracionTwitterAndrea(this.TabModuleId); 字符串consumerKey=configuracion.consumerKey; 字符串consumerSecret=configuracion.consumerSecret; if(string.IsNullOrEmpty(consumerKey)| string.IsNullOrEmpty(ConsumerCret)) {this.mvtwitteranderia.SetActiveView(this.vwconfiguration);} 否则{ IOAuthCredentials objCredenciales=新会话状态凭据(); if(objCredenciales.ConsumerKey==null | | objCredenciales.ConsumerSecret==null) { objCredenciales.ConsumerKey=configuracion.ConsumerKey; objCredenciales.ConsumerSecret=configuracion.ConsumerSecret; } wbAuthorizer=新的WebAuthorizer{ 凭证=objCredenciales, PerformRedirect=authUrl=>Response.Redirect(authUrl)}; 如果(!Page.IsPostBack){ wbAuthorizer.CompleteAuthorization(Request.Url); } if(string.IsNullOrEmpty(objCredenciales.ConsumerKey)| string.IsNullOrEmpty(objCredenciales.ConsumerCret)){ lblRegistrado.Text=“没有自动编辑”; btnAutorizar.Visible=true; btnTweets.Visible=false; }如果(wbAuthorizer.IsAuthorized){ lblRegistrado.Text=“Estas Autorizado。”; btnAutorizar.Visible=false; btnTweets.Visible=true; } this.mvtwitter.andrea.SetActiveView(vwatrorizacion); }}catch(Exception ex){Exceptions.ProcessModuleLoadException(this,ex); } } 受保护的无效Btneviar_单击(对象发送方,事件参数e){ comunicacionwitter objTwitter=新的comunicacionwitter(this.TabModuleId); 状态objStatus=objTwitter.ActualizarEstado(wbAuthorizer,this.txtEstado.Text); } 受保护的无效btnAutorizar\u单击(对象发送方,事件参数e){ 试试{ wbAuthorizer.BeginAuthorization(Request.Url); }捕获(例外情况除外){} } 受保护的无效btnTweets\u单击(对象发送方,事件参数e){ 试试{ wbAuthorizer=新的WebAuthorizer{ 凭据=新会话状态凭据()}; comunicacionwitter objTwitter=新的comunicacionwitter(this.TabModuleId); var UltimosTweets=objTwitter.getHomeTimeLine(wbAuthorizer,intCantidadTweets); foreach(在UltimosTweets中的var Tweet){ this.spnTweets.InnerHtml=”“+ “Usario”+Tweet.ScreenName+“”+ “”+Tweet.Text+“”+ “”+Tweet.CreatedAt+“”+ ""; } this.mvTwitterAndrea.SetActiveView(this.vwteets); }捕获(例外情况除外){} } } } *********我还有一节课

Class ConfiguracionTwitter{
public ConfiguracionTwitter(){} 
public IEnumerable<Status> getHomeTimeLine(WebAuthorizer auth,int intCantidadTweets) {               
twitterContexto= new TwitterContext(auth);           
var tweets =        
(from tweet in twitterContexto.Status                       
where tweet.Type == StatusType.Home                        
select tweet).Take(intCantidadTweets).ToList();           
return tweets;        
}
}
类配置器{
公共配置Witter(){}
公共IEnumerable getHomeTimeLine(WebAuthorizer auth,int intCantidadTweets){
twitterContexto=新的TwitterContext(auth);
var tweets=
(来自twitterContexto.Status中的tweet)
其中tweet.Type==StatusType.Home
选择tweet.Take(intcantidtweets.ToList();
返回推文;
}
}
一个“401未经授权”表示您的应用程序无法通过Twitter进行身份验证。有很多事情会导致401。我已经编写了一个FAQ,它将为您提供一个要检查的事项列表:

顺便说一句,发布OAuth密钥会使应用程序不安全。您应该尽快访问Twitter页面上的应用程序,并生成一组新的密钥


好的,乔·梅奥,现在我正在换OAuth钥匙!!
Class ConfiguracionTwitter{
public ConfiguracionTwitter(){} 
public IEnumerable<Status> getHomeTimeLine(WebAuthorizer auth,int intCantidadTweets) {               
twitterContexto= new TwitterContext(auth);           
var tweets =        
(from tweet in twitterContexto.Status                       
where tweet.Type == StatusType.Home                        
select tweet).Take(intCantidadTweets).ToList();           
return tweets;        
}
}