/// <summary>
        /// Internal web request generator
        /// </summary>
        /// <param name="url"></param>
        /// <param name="method"></param>
        /// <param name="credentials"></param>
        /// <param name="bAllowStreamBuffering"></param>
        /// <param name="context"></param>
        /// <param name="callback"></param>
        /// <returns></returns>
        protected WebRequest CreateWebRequest(String url, String method, ICredentials credentials, Boolean bAllowStreamBuffering, Object context, CreateWebRequestPreparationCallback callback)
        {
#if !WINDOWS_PHONE
            // 1. create and start the watch
            Stopwatch watch = new Stopwatch();
            watch.Start();
#endif
            
            // 2. build uri
            Uri uriNew = new Uri(url);

            // 2. create request 
            WebRequest request = CreateBasicWebRequest(uriNew, bAllowStreamBuffering);
            request.Method = method.ToString().ToUpper();                        
            
            // 3. call back
            if (callback != null)
                callback(request, context);

#if !WINDOWS_PHONE
            // 4. set the proxy class if needed
            if (WebRequestManager.Instance.GetProxySettings() != null)
                request.Proxy = WebRequestManager.Instance.GetProxySettings();

            // 4.1. check if we got a null proxy
            if (request.Proxy != null && request.Proxy is WebRequestManagerNullProxy)
                request.Proxy = null;
#endif
            // 5. set the credentials if needed
            if (credentials != null)
            {
                request.Credentials = credentials;

#if !WINDOWS_PHONE                
                try
                {
                    request.PreAuthenticate = true;
                }
                catch (NotSupportedException)
                { }
#endif
            }

            // 6. notify
            WebRequestManager.Instance.NotifyWebRequestPrepared(request);

#if !WINDOWS_PHONE
            // 7. add watch object to tls
            LocalDataStoreSlot slot = Thread.GetNamedDataSlot(watchTag);
            Thread.SetData(slot, watch);
#endif

            // 8. return the request
            return request;
        }
        /// <summary>
        /// Internal web request generator
        /// </summary>
        /// <param name="url"></param>
        /// <param name="method"></param>
        /// <param name="credentials"></param>
        /// <param name="bAllowStreamBuffering"></param>
        /// <param name="context"></param>
        /// <param name="callback"></param>
        /// <returns></returns>
        protected WebRequest CreateWebRequest(String url, String method, ICredentials credentials, Boolean bAllowStreamBuffering, Object context, CreateWebRequestPreparationCallback callback)
        {
#if !WINDOWS_PHONE
            // 1. create and start the watch
            Stopwatch watch = new Stopwatch();
            watch.Start();
#endif

            // 2. build uri
            Uri uriNew = new Uri(url);

            // 2. create request
            WebRequest request = CreateBasicWebRequest(uriNew, bAllowStreamBuffering);
            request.Method = method.ToString().ToUpper();

            // 3. call back
            if (callback != null)
            {
                callback(request, context);
            }

#if !WINDOWS_PHONE
            // 4. set the proxy class if needed
            if (WebRequestManager.Instance.GetProxySettings() != null)
            {
                request.Proxy = WebRequestManager.Instance.GetProxySettings();
            }

            // 4.1. check if we got a null proxy
            if (request.Proxy != null && request.Proxy is WebRequestManagerNullProxy)
            {
                request.Proxy = null;
            }
#endif
            // 5. set the credentials if needed
            if (credentials != null)
            {
                request.Credentials = credentials;

#if !WINDOWS_PHONE
                try
                {
                    request.PreAuthenticate = true;
                }
                catch (NotSupportedException)
                { }
#endif
            }

            // 6. notify
            WebRequestManager.Instance.NotifyWebRequestPrepared(request);

#if !WINDOWS_PHONE
            // 7. add watch object to tls
            LocalDataStoreSlot slot = Thread.GetNamedDataSlot(watchTag);
            Thread.SetData(slot, watch);
#endif

            // 8. return the request
            return(request);
        }