0

I've a Wcf Service Application with jsonp that I consume using jquery like this:

    function CallService() {
        $.ajax({
            type: Type, //GET or POST or PUT or DELETE verb
            url: Url, // Location of the service
            data: Data, //Data sent to server
            contentType: ContentType, // content type sent to server
            dataType: DataType, //Expected data format from server
            processdata: ProcessData, //True or False
            success: function (msg) {//On Successfull service call
                ServiceSucceeded(msg);
            },
            error: ServiceFailed// When Service call fails
        });
    }

I've hosted the WCF Service using IIS 5.1 and now I want to use the Windows Authentication parameter.

What do I've to do in jquery for this to work?

aF.
  • 64,980
  • 43
  • 135
  • 198

1 Answers1

2

I guess you need to implement www-authentication for your service:

Adding basic HTTP auth to a WCF REST service

then, according to the jQuery documentation, you can make authenticated ajax calls by setting the username and password variables accordingly:

http://api.jquery.com/jQuery.ajax/

Community
  • 1
  • 1
balint
  • 3,391
  • 7
  • 41
  • 50
  • for example, I may use basic authentication with https? is this correct? – aF. Oct 28 '11 at 13:08
  • yes, that will do: http://stackoverflow.com/questions/5511589/securing-an-api-ssl-http-basic-authentication-vs-signature – balint Oct 28 '11 at 13:14