I am trying to set a policy for leaving unescaped character %2f ,while using urls before sending a hammock rest request.as some .net developers may know, there are encoding problems ,while trying to use unescaped characters in the PUBLIC url string for calling the linkedin api.
App.config is out of the question as its a phone project.
reflection is another workaround suggested on avrious sites including this one.
while using one of the solutions,
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);
I am getting the following error.-
Additional information: Attempt by method
'PhotonWorld.View.LinkedinAuthPage.AddAllowAnyOtherHostFlagToHttpUriParser()' to
access method 'System.UriParser.GetSyntax(System.String)' failed
i guess this is specific to phone .i am using wp8.
any one else had issues?