Hey, I know this question is 2 years old, but I ran into the same problem. I think you will find that WebRequest.RegisterPrefix() does returns false if you are trying to register http: (note a single colon, without a slash). If I ever find a workaround, I will try to remember this post.
EDIT
In my specific case, I wanted to throw away System.Net.FtpWebRequest and roll back my own implementation of the FTP client (because the framework implementation sucks ).
To do this, I used reflection (and a bunch of late linking tricks) to get the arraylist of the registered prefix and remove those that are associated with the System.Net.FtpWebRequestCreator inner class.
I'm not sure if all these APIs are available for a Windows phone, but here is what I did:
Type webRequest = typeof(System.Net.WebRequest); Assembly system = Assembly.GetAssembly(webRequest); Type ftpWebRequestCreator = system.GetType("System.Net.FtpWebRequestCreator"); ArrayList prefixList = (ArrayList)webRequest.GetProperty("PrefixList", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null, null); IEnumerator enumerator = prefixList.GetEnumerator(); while (enumerator != null && enumerator.MoveNext()) { if (object.ReferenceEquals(enumerator.Current.Creator.GetType(), ftpWebRequestCreator)) { prefixList.Remove(enumerator.Current); if (System.Net.WebRequest.RegisterPrefix(enumerator.Current.Prefix, new CustomWebRequestCreator())) { enumerator = null; } else { enumerator = prefixList.GetEnumerator(); } } }
This allows you to find all the prefixes registered in the FtpWebRequestCreator and replacing them with your own creator. It should be pretty simple to adapt this for http (s).
source share