I need to write a small application that creates an external url with the windows user name in the query string, then redirects the user to the url.
I thought that a WCF service is not the right way to go, because it says this about WCF on the MSDN link below:
"HttpContext: Current is always null when accessed from within a WCF service."
But, I wanted to verify with someone, because I'm always looking for an excuse to get more experience writing WCF services.
Also, I found at this link: http://www.codeproject.com/KB/aspnet/How_to_NT_User_Name.aspx
that there are more ways than httpcontext to get the user name:
using three ways we can get the User Name using C#
ncipal p = System.Threading.Thread.Cu
ipal as System.Security.Principal.
string strName = p.Identity.Name;
[ OR ]
2) string strName = HttpContext.Current.User.I
[ OR ]
3) string strName = Request.ServerVariables["A
; //Finding with name
string strName = Request.ServerVariables
; //Finding with index
In Above 3 Cases returnin string contains DomainName\WinNTLoggedUser
(for Ex: Microsoft\Bill.Gates. Here Microsoft is domain Bill.Gates is Logger User Name )
Using string operations seperate the DomainName and UserName.
Could any of these ways work with a WCF service?