c# - Ajax POST call to code behind method, asking for windows authentication credentials -
i trying call function adduser on accounts page:
[webmethod] protected bool adduser(string username) { ... } with ajax call, triggered button click:
var nameparam = inputfield.value; $.ajax({ type: "post", url: "accounts.aspx/adduser", data: {username:nameparam}, contenttype: "application/json; charset=utf-8", datatype: "json", success: function (retvalue) { console.log(retvalue); } }); since whole web app using windows authentication asked credentials, avoid. however, when inputting credentials account using, prompted again no error message. doesn't seem matter input. prompted again , again, no errors, no matter what.
can somehow avoid getting prompted @ all? since authenticated, can't click button if i'm not authenticated.
any appreciated!
edit 1:
i noticed javascript error:
accounts.aspx/adduser failed load resource: server responded status of 401 (unauthorized) edit 2:
more detailed error:
jquery-3.1.1.js:9536 post http://localhost/dismaintenancesite/accounts.aspx/adduser 401 (unauthorized) send @ jquery-3.1.1.js:9536 ajax @ jquery-3.1.1.js:9143 submituser @ buttonscripts.js:120 onkeydown @ accounts:128 trigger @ jquery-3.1.1.js:8177 (anonymous) @ jquery-3.1.1.js:8239 each @ jquery-3.1.1.js:368 each @ jquery-3.1.1.js:157 trigger @ jquery-3.1.1.js:8238 addclick @ buttonscripts.js:138 onclick @ accounts:130 i after hitting cancel on prompt. during attempts still no errors, whether correct or not.
Comments
Post a Comment