dcsimg


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Please Help !!! ajax autocomplete extender javascript error 'Access Denied'

  1. #1
    Join Date
    Apr 2008
    Posts
    1

    Please Help !!! ajax autocomplete extender javascript error 'Access Denied'

    Hi
    I am using ajax autocomplete extender for a text box. It works fine if I create the webservice that calls the data in my project itself. However, when I try to use a webservice which existing on another project inside my solution, I keep getting the java script error "Access Is Denied".

    Can some one help what is wrong?

    (My source code is below)

    Thank in advance

    This is my AutoComplete.asmx file - this file is in a seperate 'Ajax Enbled web site project'''

    using System;
    using System.Data;
    using System.Web;
    using System.Collections.Generic;
    using System.Web.Services;
    using System.Web.Services.Protocols;
    using System.ComponentModel;

    using System.Web.Script.Services;

    namespace BusinessLogicWS
    {

    /// <summary>

    /// Summary description for AutoComplete

    /// </summary>

    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

    [System.Web.Script.Services.ScriptService]
    public class AutoComplete : System.Web.Services.WebService

    {

    [WebMethod]public string[] GetCompletionList(string prefixText, int count)
    {

    if (count == 0)
    {

    count = 10;

    }

    if (prefixText.Equals("xyz"))
    {

    return new string[0];
    }

    Random random = new Random();
    List<string> items = new List<string>(count);

    for (int i = 0; i < count; i++)
    {

    char c1 = (char)random.Next(65, 90);
    char c2 = (char)random.Next(97, 122);

    char c3 = (char)random.Next(97, 122);


    items.Add(prefixText + c1 + c2 + c3);

    }

    return items.ToArray();
    }

    }

    }

    This is my ajax auto complete extender control which calls the web service - this is in a class library and within a webpart

    <ajaxToolkit:AutoCompleteExtender runat="server" BehaviorID="AutoCompleteEx" ID="autoComplete1" ServicePath = "http://localhost:49573/AutoComplete.asmx"

    TargetControlID="txtAutoComplete" ServiceMethod="GetCompletionList" MinimumPrefixLength="2"

    CompletionInterval="1000" EnableCaching="true" CompletionSetCount="20" CompletionListCssClass="autocomplete_completionListElement"

    CompletionListItemCssClass="autocomplete_listItem" CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem"

    DelimiterCharacters=";, :">

    </ajaxToolkit:AutoCompleteExtender>

  2. #2
    Join Date
    May 2007
    Posts
    6
    "Access Denied" errors mainly occur because of the cross domain access problem in ajax apps. The xmlhttprequest object cannot access data from another domain. You can try using a proxy.
    More on PHP Ajax and other technologies @ my homepage:
    www.tejuspratap.com

  3. #3
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,663
    It can also be caused by IE Security restrictions.

Similar Threads

  1. javascript within body in ajax
    By ksr04 in forum AJAX
    Replies: 3
    Last Post: 08-21-2010, 03:51 PM
  2. Replies: 0
    Last Post: 12-15-2007, 07:19 PM
  3. Ajax calendar extender behavior
    By smakawhat in forum AJAX
    Replies: 0
    Last Post: 07-10-2007, 11:13 AM
  4. Replies: 0
    Last Post: 08-28-2006, 04:05 AM
  5. Sample Sites.
    By Murray Foxcroft in forum Web
    Replies: 5
    Last Post: 11-02-2000, 03:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center