读书人

新浪微博C# SDK Demo运行时报错解决方

发布时间: 2013-04-02 12:35:26 作者: rapoo

新浪微博C# SDK Demo运行时报错
新浪微博C# SDK Demo运行时报错解决方法非常纳闷,AppKey跟AppSecret都更换了,回调地址也设置好了,但运行时就说"没有找到设置属性“1334886379”。"这AppKey是我刚创建的微博应用申请的
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("1334886379")]
public string AppKey {
get {
return ((string)(this["1334886379"]));
}
set {
this["1334886379"] = value;
}
}

[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("a355c237795f55c073dc8885b45b821d")]
public string AppSecret {
get {
return ((string)(this["a355c237795f55c073dc8885b45b821d"]));
}
set {
this["a355c237795f55c073dc8885b45b821d"] = value;
}
}

[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("http://127.0.0.1")]
public string CallbackUrl {
get {
return ((string)(this["http://127.0.0.1"]));
}
set {
this["http://127.0.0.1"] = value;
}
} 新浪微博 c#
[解决办法]
不是这样搞的吧,你有申明这个类下的1334886379 属性,你的属性应该是AppKey 吧?
这样看看
string appKey = "1334886379";//没有必要还专门通过属性名称来赋值吧?


public string AppKey {
get {
return appKey;
}
set {
appKey= value;
}
}

[解决办法]
如果觉得按你的方式写,语法的地方改下:
[UserScopedSettingAttribute()]
[DefaultSettingValueAttribute("1334886379")]
public string AppKey
{
get { return (string)this["AppKey"]; }//注意,里边不是1334886379 啊,那是默认值
set { this["AppKey"] = value; }
}

读书人网 >C#

热点推荐