Using ajax to call a web service when Windows Authentication turned on?

Last post 07-18-2009 12:55 AM by imran_ku07. 4 replies.

Sort Posts:

  • Using ajax to call a web service when Windows Authentication turned on?

    02-27-2009, 10:41 AM
     

    Hi

    I am trying to call a web service method from javascript:

    function Search() {

           
    var context = new Object;
            context
    .Filter = "Test";

           
    SearchService.GetSearch(context, onSuccess, onFailed);
       
    }

       
    function onSuccess(result) {
           
    // userContext contains symbol passed into method
           
    var res = document.getElementById("resultsDiv");
            res
    .innerHTML = result;
       
    }

       
    function onFailed(result) {
           
    var res = document.getElementById("resultsDiv");
            res
    .innerHTML = result.get_message();
       
    }

    Here's the web service signature:

    [WebMethod]
       
    public SearchComboBoxItemData[] GetSearch(object context)
       
    {

    When I use forms authentication and allow anonymous access to the web service, everything works fine.

    However, when I use windows authentication for the application, but only allow anonymous access to the webservice, calling the web service from javascript throws the following error:

    Invalid web service call, missing value for parameter: 'context'.

    Another thing I noticed is that it works fine both ways in Firefox. I am seeing the error on IE7.

    Any thoughts on a possible solution?

  • Re: Using ajax to call a web service when Windows Authentication turned on?

    02-28-2009, 12:53 PM
    • Star
      10,558 point Star
    • Danny117
    • Member since 12-16-2008, 2:30 PM
    • Royal Oak Michigan USA
    • Posts 1,837

    Are you missing a parm on your call? 

    calebsandfort:
    SearchService.GetSearch(context, onSuccess, onFailed)

     

    Good Luck



  • Re: Using ajax to call a web service when Windows Authentication turned on?

    03-02-2009, 12:41 AM
    Answer
    • All-Star
      17,363 point All-Star
    • imran_ku07
    • Member since 06-04-2008, 9:21 AM
    • KARACHI, PAKISTAN
    • Posts 3,172

    pass credential to webservice wiith preCondition="integratedMode"

    http://forums.asp.net/t/1081554.aspx

     

  • Re: Using ajax to call a web service when Windows Authentication turned on?

    07-17-2009, 2:33 AM
    • Member
      2 point Member
    • chengliuyy
    • Member since 07-17-2009, 6:28 AM
    • Posts 1

    Hi, imran_ku07,

    I have the same problem. But the web service is on  IIS 6.0.

    as I know,  the preCondition property you said is for IIS7.0

    so what can I do on IIS6.0?

    does anyone have any idea?

    thanks.

  • Re: Using ajax to call a web service when Windows Authentication turned on?

    07-18-2009, 12:55 AM
    • All-Star
      17,363 point All-Star
    • imran_ku07
    • Member since 06-04-2008, 9:21 AM
    • KARACHI, PAKISTAN
    • Posts 3,172

    Try to  Allow Anonmious User in these Files,

    Please check this,

    http://www.dotnetnuke.com/Community/Forums/tabid/795/forumid/111/threadid/287650/scope/posts/threadpage/1/Default.aspx


Page 1 of 1 (5 items)