【发布时间】:2014-03-20 12:30:07
【问题描述】:
我正在尝试设置保留未转义字符 %2f 的策略,同时在发送吊床休息请求之前使用 url。正如一些 .net 开发人员可能知道的那样,在尝试在 PUBLIC url 中使用未转义字符时存在编码问题调用linkedin api的字符串。
App.config 作为手机项目是不可能的。
reflection 是其他网站上建议的另一种解决方法,包括这个。
在使用其中一种解决方案时,
var getSyntaxMethod =
typeof(UriParser).GetMethod("GetSyntax", BindingFlags.Static |
BindingFlags.NonPublic);
if (getSyntaxMethod == null)
{
throw new MissingMethodException("UriParser", new Exception("GetSyntax"));
}
var uriParser = getSyntaxMethod.Invoke(null, new object[] { "http" });
var flagsField =
uriParser.GetType().BaseType.GetField("m_Flags", BindingFlags.Instance |
BindingFlags.NonPublic);
if (flagsField == null)
{
throw new MissingFieldException("UriParser", new Exception("m_Flags"));
}
int oldValue = (int)flagsField.GetValue(uriParser);
oldValue += 4096;
flagsField.SetValue(uriParser, oldValue);
我收到以下错误。-
Additional information: Attempt by method
'PhotonWorld.View.LinkedinAuthPage.AddAllowAnyOtherHostFlagToHttpUriParser()' to
access method 'System.UriParser.GetSyntax(System.String)' failed
我猜这是特定于手机的。我正在使用 wp8。
其他人有问题吗?
【问题讨论】:
标签: .net windows-phone-8 linkedin