locked
VPN auto connect leads problem when accessing the private url in my app through HttpClient

    Question

  • Hi,

    I have app to execute my WCF service through HttpClient(). I configured my SSL VPN in sonicwall mobile connect with auto connect option. So when accessing my internal WCF service, Wp 8.1 asks the VPN connection screen. If I follow the screen, VPN has connected and return to my App. But here I received "An error has ocurred. While sending request to server" in Wp 8.1 screen. Even if I debug through visual studio I couldn't catch or track the actual error in code. Below the code I am using for your reference. Kindly help me in this regard.

     try
                        {
                            HttpClientHandler handler = new HttpClientHandler(); ;
                            handler.AllowAutoRedirect = false;
                            
                            HttpClient httpClient = new HttpClient(handler);
                            httpClient.MaxResponseContentBufferSize = 256000;
    
                            
                            HttpResponseMessage response = await httpClient.GetAsync("http://172.0.0.11/xxxxx/Service1.svc/xxxxCheck/" + usr.username + "/" + App.DeviceId + "/" + usr.password);
                            response.EnsureSuccessStatusCode();
                            string content = await response.Content.ReadAsStringAsync();
    
                            List<EmcUserResult> userres = JsonConvert.DeserializeObject<List<EmcUserResult>>(content);
                            if (userres.FirstOrDefault().Allowed == "TRUE")
                                NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative)); // call MainPage
                            else
                                MessageBox.Show("This User was blocked. Contact admin.");
                           
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message);
                        }


    Wednesday, January 28, 2015 3:45 AM

Answers

  • I recommend that you check the network traffic by using either Wireshark or Fiddler to see what's going on with the request.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Wednesday, January 28, 2015 2:22 PM
    Moderator