AJAX AutoCompleteExtender and Access Denied.

Last post 07-01-2009 2:40 PM by markymark1050. 4 replies.

Sort Posts:

  • AJAX AutoCompleteExtender and Access Denied.

    02-04-2009, 9:12 AM
    • Member
      180 point Member
    • markymark1050
    • Member since 01-10-2009, 10:58 AM
    • Bristol, UK
    • Posts 141

    Hi there.

    I have a web service external to my asp.net web application ( both written in C#) and within my web application I have attached an AutoComplete on a TextBox.

    As my web Service is external to the web application, I am qualifying the

    ServicePath=http://localhost/MyWebService/Service.asmx,

    do I also need to include a ServiceReference in the ScriptManager tag?  (First question)

    When I start up my web application and start to type into the TextBox I am receiving a JavaScript runtime error of "Access is denied".

    Obviously I have done something daft here but I'm not sure if it is something to do with having the external web service and hence web method?  Any help will be greatly appreciated please?

    Thank you.

    Mark :)

  • Re: AJAX AutoCompleteExtender and Access Denied.

    02-04-2009, 10:45 AM
    Answer
    • Contributor
      5,070 point Contributor
    • mrmercury
    • Member since 04-04-2006, 6:26 PM
    • Mexico City, Mexico
    • Posts 738
    You can’t make cross-domain XMLHttpRequest calls, even if the application and the WebService are on the same machine they need to be under the same folder, this is why you are getting the access denied error, this is a constrain imposed by the browser not by AJAX, you could do two things to solve this: you could move the WebService under your application´s project, or if you need the WebService to be under a different project you could add a “bridge” WebService in your application that would be called by the client and in turn would call the external WebService and return the result to the client.
    If this post helped you please remember to set it as Answer so it can help others.
  • Re: AJAX AutoCompleteExtender and Access Denied.

    02-04-2009, 10:59 AM
    • Member
      180 point Member
    • markymark1050
    • Member since 01-10-2009, 10:58 AM
    • Bristol, UK
    • Posts 141

    Thank you, I will give the dual web service approach a go and hopefully solve matters down that route.

    Mark :)

  • Re: AJAX AutoCompleteExtender and Access Denied.

    06-11-2009, 5:38 AM
    • Member
      2 point Member
    • Fern82
    • Member since 06-11-2009, 9:36 AM
    • Posts 1

    Hi,

     I have the same issue, did you solve it?

     Thanks.

  • Re: AJAX AutoCompleteExtender and Access Denied.

    07-01-2009, 2:40 PM
    • Member
      180 point Member
    • markymark1050
    • Member since 01-10-2009, 10:58 AM
    • Bristol, UK
    • Posts 141

    Hi there.

    Only just saw this.  The solution was to create an internal web service for the AJAX extender to communicate with and then this internal web service gets the required details from the external web service, as the AJAX control cannot call an external web service.

    Hope that helps.

    Thank you.

    Mark :)

Page 1 of 1 (5 items)