You could try System.Uri.EscapeUriString or System.Uri.EscapeDataString instead, they might work for you.
http://stackoverflow.com/questions/3840762/how-do-you-urlencode-without-using-system-web/8451941#8451941 On Sun, Sep 30, 2012 at 9:39 PM, Maurício Linhares < [email protected]> wrote: > No, but the code I was using was calling > System.Web.HttpUtility.UrlEncodeToBytes(input) to URL encode a string > and this was causing the TraceManager to be loaded. > > I ended up writing my own URL encoding solution to avoid calling this code. > > - > Maurício Linhares > http://techbot.me/ - http://twitter.com/#!/mauriciojr > > > On Sun, Sep 30, 2012 at 5:50 AM, Daniel Lo Nigro <[email protected]> wrote: > > How are you doing the HTTP requests? Through WebRequest, WebClient or > > HttpClient? > > > > The error is coming from System.Web.TraceManager which I believe handles > > application-level ASP.NET tracing (so I'm not sure why it's being > invoked > > with a console application). Do you have anything odd in your App.config > > file? > > > > On Fri, Sep 28, 2012 at 11:55 PM, Maurício Linhares > > <[email protected]> wrote: > >> > >> I'm getting the following error for some of the HTTP requests I'm > making: > >> > >> Exception during TraceManager initialization: > >> System.Reflection.TargetInvocationException: Exception has been thrown > >> by the target of an invocation. ---> System.MissingMethodException: > >> Method not found: > >> 'System.Configuration.IConfigurationSectionHandler.Create'. > >> at System.Reflection.MonoMethod.Invoke (System.Object obj, > >> BindingFlags invokeAttr, System.Reflection.Binder binder, > >> System.Object[] parameters, System.Globalization.CultureInfo culture) > >> [0x000eb] in > >> > /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/corlib/System.Reflection/MonoMethod.cs:234 > >> at System.Reflection.MethodBase.Invoke (System.Object obj, > >> System.Object[] parameters) [0x00000] in > >> > >> > /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/corlib/System.Reflection/MethodBase.cs:96 > >> at System.Web.Configuration.WebConfigurationManager.GetSection > >> (System.String sectionName, System.String path, System.Web.HttpContext > >> context) [0x001e6] in > >> > >> > /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.Web/System.Web.Configuration_2.0/WebConfigurationManager.cs:516 > >> at System.Web.Configuration.WebConfigurationManager.GetSection > >> (System.String sectionName, System.String path) [0x00000] in > >> > >> > /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.Web/System.Web.Configuration_2.0/WebConfigurationManager.cs:418 > >> at > >> > System.Web.Configuration.WebConfigurationManager.GetWebApplicationSection > >> (System.String sectionName) [0x0002c] in > >> > >> > /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.Web/System.Web.Configuration_2.0/WebConfigurationManager.cs:670 > >> at System.Web.TraceManager..ctor () [0x0001c] in > >> > >> > /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System.Web/System.Web/TraceManager.cs:55 > >> > >> By looking at the source, the method doesn't really exists, so I'm > >> pretty puzzled as to why the mono runtime is making a direct call to > >> something that doesn't exist at all. > >> > >> Also, it seems like this code is related to webapplications but I'm > >> running a console app that makes HTTP requests, not a web server. Is > >> this some kind of configuration that I'm missing? > >> > >> What's funny is that many other HTTP requests do work, but some > >> specific ones fail with this error and the stack trace is not exactly > >> revealing as to why this class is being called at all. > >> > >> Any hints on how to solve this issue? > >> > >> - > >> Maurício Linhares > >> http://techbot.me/ - http://twitter.com/#!/mauriciojr > >> _______________________________________________ > >> Mono-list maillist - [email protected] > >> http://lists.ximian.com/mailman/listinfo/mono-list > > > > >
_______________________________________________ Mono-list maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-list
