views:

1053

answers:

3

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?

A: 

Hey

I assume you are using ASP.NET Ajax.

You could try adding:

preCondition="integratedMode"

attribute to the Modules section of your web.config file.

Hope this helps

w4ymo
A: 

It sounds like you're using integrated authentication, and IE has logged in, but Firefox hasn't. You may want to check the username that IE is logged in under.

Also, something along the lines of:

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

To see just what context contains.

cofiem
+1  A: 

Check this Link, it may help you

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

Anuraj