tags:

views:

857

answers:

2

I am using the $.ajax function in jquery to make a call to an asmx service. When I look at the requests from fiddler, I see two requests for each call I make. One has a content type of text/html which of course returns a 401 not authorized status, and the other one has the correct content type and returns the correct data. Can anyone tell me why it is doing this and how I can fix it or if it needs fixing?

+3  A: 

That is normal when you have anonymous requests disabled (you probably have Windows authentication enabled). The 401 is a challenge asking for the credentials.

Otávio Décio
A: 

@ocdecio This is not an answer it's a question.

How can i skip win authentication if webmethod called from the same application/website? Or how can i pass win credentials to webmethod or webservice to skip win login prompt.

Thanx.

$.ajax({ type: "POST", url: "http://localhost/Admin/dev/test.aspx/GetQueue", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", success: function(msg) { alert(msg); } }); Should i pass my username to ajax call? $.ajax({ username:"jSmith" });

pyccki