XML Webservice - Integrated windows authentication
Hi all,
I have a simple web method to return the current logon user id as follows
[WebMethod]
public string GetLogonUserID()
{
return System.Web.HttpContext.Current.Request.ServerVaria bles["LOGON_USER"];
}
If i call this web method by using IE testpage, it returns actual login user (domain\userid).
If i call this web method by using web refrence, it returns "domain\ASPNET"
Web method calling code:
WebApplication1.pws5.Service1 proxy = new WebApplication1.pws5.Service1();
proxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
proxy.PreAuthenticate = true;
System.String strRetVal = proxy.GetLogonUserID();
Response.Write(strRetVal);
Note: webservice is not anonymous and it is integrated windows authentication.
For reference please see the following authentication and authorization section of web.config
<authentication mode="Windows" />
<authorization>
<allow users="*" />
<deny users="?" />
</authorization>
If anybody could advice me any workaround to get actual NT login userid by calling above webmethod then it will be greatful.
Thanks in advance.
Thanks & Regards
Anees Ahamed.N.
|