October 19, 2010

0 Determining Identity in a Web service in ASP.NET

 Determining Identity in a Web service

 The following code can be used within a Web service to obtain identity information.
[WebMethod]
public string GetDotNetThreadIdentity()
{
return Thread.CurrentPrincipal.Identity.Name;
}
[WebMethod]
public string GetWindowsThreadIdentity()
{
return WindowsIdentity.GetCurrent().Name;
}
[WebMethod]
public string GetUserIdentity()
{
return User.Identity.Name;
340 Building Secure ASP.NET Applications
}
[WebMethod]
public string GetHttpContextUserIdentity()
{
return HttpContext.Current.User.Identity.Name;
}

More Information

For a list of all security related Knowledge Base articles
For a list of security related articles that deal with frequently seen error messages,
use the following link go to the Microsoft Knowledge Base and use the
following search keywords:

prb kbsecurity kbaspnet

0 comments:

Post a Comment

Blogger Themes

 
Powered by Blogger