Hi.

I've mentioned in other topic, that a company I'm working for is writing an
app for android using monodroid. We've stumbled upon a problem which to be
honest is quite iritating. The problem is with getting a response stream
from the server. The issue happens using .NET WebClient class as well as
HttpWebRequest, as we tried both.

But this, we only figured out recently, till now we were not aware what is
the problem. Thankfully we came across this error, and taking a while
looking on the internet we found people having same issue, when they are
using any framework originated from mono:

http://stackoverflow.com/questions/3674692/mono-webclient-invalid-ssl-certificates
http://mono.1490590.n4.nabble.com/sending-smtp-email-under-SSL-td1536371.html
http://s251.codeinspot.com/q/1230250
http://www.mono-project.com/UsingTrustedRootsRespectfully

This issue happens only on 1 of the smartfones the app was tested on, the
HTC Desire(although by reading from the xamarin site about this problem I
think it's not the device problem, correct? Which makes things even worse,
if it's not connected to the hardware problem). The others, about dozen of
them works perfectly fine with same code.

We tried the Callback resolution as well as the "NoCheckCertificatePolicy"
class. Nothing worked, the issue is still there and this is a big problem as
this simply cannot stay like that, and the whole project is dangered if
"some random phones" won't simply work with this application.

The funny thing is we have this issue only with 2 of the server
funcionalities we contact with out of about 8. All of them are based on GET
http request, and all lead to the same base address. The 2 methods that do
not work are written in exactly same way (notice below is WebClient, we
normaly used HttpWebRequests but we tried WebClient, as I've found some
people saying monodroid has some "problems" with HttpWebRequests).

I'll stripped the following part, as it's not important. Code1:

string _tempAdress = BazeURLHelpers.BazeURL + _object.ToString() +
System.Uri.EscapeDataString((JsonConvert.SerializeObject(_object)).ToString());
WebClient request = new WebClient();
var dataStream = request.OpenRead(_tempAdress);    //this is the line
Exception is being risen

Second method:

string _tempAdress = BazeURLHelpers.BazeURL + _object.ToString() +
System.Uri.EscapeDataString((JsonConvert.SerializeObject(_object)).ToString());
WebRequest request = WebRequest.Create(_tempAdress);
request.Credentials = CredentialCache.DefaultCredentials;
using (WebResponse response = request.GetResponse())     //this is the line
Exception is being risen
{
...
}

We would like to hear a solution to this problem, as both suggestions in the
threads from the beginning of this post do not work.

sincerely
Lucas



--
View this message in context: 
http://mono-for-android.1047100.n5.nabble.com/Error-getting-response-stream-mono-monodroid-monotouch-problem-tp5711340.html
Sent from the Mono for Android mailing list archive at Nabble.com.
_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to