Note that there are some explanatory texts on larger screens.

plurals
  1. POasp.net C# windows authentication iss config
    primarykey
    data
    text
    <p>I'm developing a webpage where a need to know the users windows authentication values, more precisely the name.</p> <p>Others developments have been done with this kind of authentication but sadly for me their creators are long gone and i have no contact or documentation.</p> <p>I'm using Visual Studio 2008 and i'm accessing a webservice that is in a remote server. The server is a windows server 2008 r2 standard and is using ISS version 7.5.</p> <p>Since i have the source code of the other developments what i did was copy paste and was working fine when i was calling the webservice that was in my machine (localhost). The code is the following:</p> <pre><code>//1st way WindowsPrincipal wp = new WindowsPrincipal(WindowsIdentity.GetCurrent()); string strUser = wp.Identity.Name;//ALWAYS GET NT AUTHORITY\NETWORK SERVICE //2nd way WindowsIdentity winId = WindowsIdentity.GetCurrent(); WindowsPrincipal winPrincipal = new WindowsPrincipal(winId); string user = winPrincipal.Identity.Name;//ALWAYS GET NT AUTHORITY\NETWORK SERVICE //3rd way IIdentity WinId = HttpContext.Current.User.Identity; WindowsIdentity wi = (WindowsIdentity)WinId; string userstr = wi.Name; //ALWAYS GET string empty btn_select.Text = userstr; btn_cancelar.Text = strUser; btn_gravar.Text = user; </code></pre> <p>As you can see i have here 3 ways to get the same and in a sad manner show my user's name. As for my web.config i have:</p> <pre><code>&lt;authentication mode="Windows"/&gt; &lt;identity impersonate="true" /&gt; </code></pre> <p>In the IIS manager i have tried lots of combination of enable and disable between Anonymous Authentication, ASP.NET Impersonation, Basic Authentication, Forms Authentication and Windows Authentication.</p> <p>Can please someone help me??</p> <p>NOTE: The respective values i get from each try are in the code</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload