locked
How can I fix the problem " WebException was unhandled" RRS feed

  • Question

  • This is the code that occur the error.

    public string GetClientToken(TokenSpecification specification) {
                object[] results = this.Invoke("GetClientToken", new object[] {
                            specification});
                return ((string)(results[0]));
            }

    What should I do to fix this problem?

    Thank in advance.
    Thursday, October 22, 2009 10:05 AM

All replies

  • Hi Zenoni,

    Generally this exception get caused by Unavailability of Internet. Please check your internet connection settings.

    Apart from that try to use "TRY ....CATCH" & go to catch/handle the exceptions.

    try
    {
      // Your Logic
    }
    catch(WebException ex)
    {
        //Your meaningful message or action
    }
    catch(Exception exp)
    {
       //Your meaningful message or action

    }

    Thanks.

    Hope this will help you :)


    Thanks, Mohsin Shaikh. If you find my post is helpful for you then mark it as answer.
    Thursday, October 22, 2009 10:22 AM
  • Hi Zenoni,

    Generally this exception get caused by Unavailability of Internet. Please check your internet connection settings.

    Apart from that try to use "TRY ....CATCH" & go to catch/handle the exceptions.

    try
    {
      // Your Logic
    }
    catch(WebException ex)
    {
        //Your meaningful message or action
    }
    catch(Exception exp)
    {
       //Your meaningful message or action

    }

    Thanks.

    Hope this will help you :)


    Thanks, Mohsin Shaikh. If you find my post is helpful for you then mark it as answer.
    Thank Mohsin S ,

    I tried to check the internet connection on my emulator but it can access web site such as google.

    Are there any possible cause that affect this error.


    Thursday, October 22, 2009 4:16 PM
  • Hi,

    What is the URL are you trying to access?

    Thanks

    Paul Diston
    http://www.smartmobiledevice.co.uk/
    Thursday, October 22, 2009 4:21 PM
  • Hi,

    What is the URL are you trying to access?

    Thanks

    Paul Diston
    http://www.smartmobiledevice.co.uk/
    Dear Paul Diston

    I'm trying to access virtual earth web service.
            [System.Web.Services.Protocols.SoapHeaderAttribute("CustomerInfoHeaderValue")]
            [System.Web.Services.Protocols.SoapHeaderAttribute("UserInfoHeaderValue")]
            [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://s.mappoint.net/mappoint-30/GetClientToken", RequestNamespace="http://s.mappoint.net/mappoint-30/", ResponseNamespace="http://s.mappoint.net/mappoint-30/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
            public string GetClientToken(TokenSpecification specification) {
                object[] results = this.Invoke("GetClientToken", new object[] {
                            specification});
                return ((string)(results[0]));
            }
    Thanks

    Cap Surapun
    Thursday, October 22, 2009 5:44 PM