Using ajax to call a web service with Windows Authentication enabled?

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 is 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 allow anonymous access to the web service, calling the web service from javascript causes the following error:

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

Another thing I noticed is that it works fine in Firefox. I see an error on IE7.

Any thoughts on a possible solution?

+5
source share
2

, ASP.NET Ajax.

:

preCondition="integratedMode"

"" web.config.

,

0

, , IE , Firefox . , IE.

, - :

var temp = "";
for(prop in context){
    temp +=prop+"= "+context[prop]+"\n";
}
alert(temp);

, .

0

All Articles