0

I have to send my password using ajax request in html page to wcf webservice and then in wcf service i want to retrive my password in following format so what can i do to set header in html page.

Password = HttpContext.Current.Request.Headers["Password"].ToString()

I use following code but it is not get password in server side means in webservice in above format.

function setHeader(xhr) 
{
     xhr.setRequestHeader('UserName', document.getElementById('textinput1').value);
}
Satinder singh
  • 10,100
  • 16
  • 60
  • 102
Suhas
  • 37
  • 9
  • xhr.setRequestHeader('Password', document.getElementById('textinput1') – Suhas Dec 17 '12 at 11:58
  • Can you show your whole JS code where you set headers for AJAX request? `setHeader` looks to be ok,but there may be an issue with how you are using it. – Viktor S. Dec 17 '12 at 12:06
  • Try this link : http://stackoverflow.com/questions/3258645/pass-request-headers-in-a-jquery-ajax-get-call – Dev Dec 17 '12 at 12:27
  • @Dev Where do you see at least a sign of jQuery here? – Viktor S. Dec 17 '12 at 12:30
  • @FAngel Read that post fully man, there is a link given below with reference to jquery site. Given 11 up votes to that answer. – Dev Dec 17 '12 at 12:37
  • success: function (response) { if (response == ("success").toLocaleLowerCase()) { alert("Loging Successfully!!.."); window.location = "patient_list.html"; } else { alert("Please Loging Again!!.."); } }, error: function (error) { alert("ERROR:", error); }, beforeSend: setHeader, – Suhas Dec 17 '12 at 12:52
  • @Suhas code in comments is hard to read. You should place it in you question by editing it. – Viktor S. Dec 17 '12 at 13:11

0 Answers0