"Fred" wrote:
> thanks David,
>
> I followed your advice on the webexception, and it returns
> "Forbidden" (both for the status code and the description)
>
> I had not configured the web service to use any web proxy settings.
> I've tried setting the server which are already configured in the
> connection settings of the phone for http traffic, but it returns the
> same error. I think it should automatically use these settings
> shouldn't it? It works fine when connected in wifi. When connected
> through activesync, it returns an SendFailure exception (no result).
> Below is the code I stripped of anything unrelated. Button1 calls the
> web service with or without proxy settings
> Button2 calls the url directly, and it works with any type of
> connection (except activesync -> sendfailure).
>
> private void button1_Click(object sender, EventArgs e)
> {
> Demographics.DemographixQuery dq = new
> DeviceApplication2.Demographics.DemographixQuery();
> if (checkBox1.Checked)
> dq.Proxy = new WebProxy("195.115.25.129", 8080);//
> proxy for http access (already in device settings)
> try
> {
> label1.Text = dq.GetVersion();
> }
> catch (WebException we)
> {
> // check the response
> HttpWebResponse response = we.Response as
> HttpWebResponse;
>
> if (null != response)
> {
> // get the reason for the exception
> HttpStatusCode status = response.StatusCode;
> String description = response.StatusDescription;
> // close the response
> response.Close();
> label1.Text = dq.Proxy.ToString();
> label2.Text = String.Format("- description:{0}\n-
> status{1}",description, status.ToString());
> }
>
> // do any further exception processing here
> }
>
>
> private void button2_Click(object sender, EventArgs e)
> {
> String url = "
http://ws.cdyne.com/DemographixWS/ > DemographixQuery.asmx";
> HttpWebRequest myReq = WebRequest.Create(url) as
> HttpWebRequest;
> WebResponse wr = myReq.GetResponse();
> label1.Text = wr.ToString();
> System.IO.Stream str = wr.GetResponseStream();
> System.IO.StreamReader sr = new
> System.IO.StreamReader(str);
> label2.Text = sr.ReadToEnd();
> }