How does one get the logged in user name using jquery?
I am using ASP.Net and have been doing it in code behind like this:
System.Web.HttpContext.Current.Request.ServerVariables["AUTH_USER"].ToString();
I am trying to authenticate a user using the login domain name and use a web service to authenticate.
<script type="text/javascript">
//<![CDATA[
$(document).ready(function() {
$.ajax({ type: "POST",
url: "DemoWebService.asmx/GetFulName",
dataType: "xml",
data: "networkId=" + arg1,
processData: false,
error: function(XMLHttpRequest, textStatus, errorThrown) { ajaxError(XMLHttpRequest, textStatus, errorThrown); },
success: function(xml) { ajaxFinish(xml); }
});
});
function ajaxFinish(xml) {
// parse the object
}
function ajaxError(xmlObj, textStatus, errorThrown) {
// Comment this out for live environments, and put a friendly error message
alert("(Ajax error: " + txt + ")");
alert(request.responseText);
}
//]]>
</script>
[WebMethod]
public string GetFulName(string networkId)
{
return networkId + "Full Name";
}