windows-authentication

ASP.NET MVC Windows Authentiaction and DirectoryServices - Get Mail Address of the current user throws an InvalidCastException

℡╲_俬逩灬. 提交于 2019-12-04 10:10:41
I am using ASP.NET MVC 4 and Windows Authentication. When I am using VisualStudio everything works fine, but when I deploy my site an exception is thrown. var emailAddress = UserPrincipal.Current.EmailAddress; throws: Unable to cast object of type 'System.DirectoryServices.AccountManagement.GroupPrincipal' to type 'System.DirectoryServices.AccountManagement.UserPrincipal'. The rest works fine. Users can authenticate and I can get the users name etc. EDIT: I enabled Impersonation on IIS. Now I get the following exception: [DirectoryServicesCOMException (0x80072020): An operations error occurred

Use Windows Authentication with OAuth 2.0

[亡魂溺海] 提交于 2019-12-04 09:37:49
问题 I have set up an OWIN authorization server and several resource servers exposing ASP.NET Web APIs. I am serving up a JWT from the authorization server that is specific to each resource server (the idea being that each resource server needs custom claims wrapped up in its token). These servers are all in an intranet environment where we historically have used Windows Authentication (Kerberos) to provide a single sign-on experience. This feature has been lost in my implementation because I am

How to allow mixed-mode authentication in IIS 7.0

谁说胖子不能爱 提交于 2019-12-04 08:37:38
How do you back-door authenticate Windows users into a website using forms authentication running on IIS 7.0? Create a separate page to handle windows logins. This page will authenticate the user and then set the Forms cookie for them. Then, add the page to the web.config to tell IIS 7 to use Windows authentication on that particular page. <configuration> ... <!-- this file captures the user and redirects to the login page --> <location path="Account/WindowsLogin.aspx"> <system.web> <authorization> <allow users="*" /> </authorization> </system.web> <system.webServer> <security> <authentication

Is it possible to retrieve data from Active Directory by impersonating a Windows authenticated user in ASP.NET?

佐手、 提交于 2019-12-04 07:57:46
I've been trying to solve this problem all day, and I've read some conflicting information within the standard google message board answers. What I'm trying to do is retrieve a domain user's (that is, the currently logged in user's) email address from active directory. My ASP.NET 4 website is setup for Windows Authentication and everything works fine until the active directory calls. When I do the following, I get a COMException on the search.findAll() line. The exception message is "An operations error occured" (Very helpful message eh?) (Stripped down code for readability) WindowsIdentity

JMeter with Windows Authentication?

早过忘川 提交于 2019-12-04 07:40:02
I am using JMeter to load test some pages that reside in a SharePoint 2007 Site. The farm that contains the pages resides in a different domain than the machine running the test, and uses Windows Authenticiation. The connection to the server is over an unencrypted (non-SSL) connection. Because of this, I need to pass login credentials to the server. How do I configure JMeter to login to the server using windows authentication? Try this Edit based on the reply: new link Scroll down to the Parameters section, Username The username to authorize. Password The password for the user. Domain The

Windows Authentication - Getting current user name

馋奶兔 提交于 2019-12-04 06:55:05
In my MVC application I want to render a table in a cshtml file, if the current log in user is some x person. I am using windows authentication and I have made the following changes in web.config file. <authentication mode="Windows"> </authentication> And in my controller when I am trying to access the current user name I am not getting any user name. I am trying the following: ViewBag.LogInUserName = Request.RequestContext.HttpContext.User.Identity.Name; This above line was working before. But I don't know whats wrong now. Also I have hosted my application on IIS now. You need to put the

Why is Windows Authentication working from local to server, but not server to server?

微笑、不失礼 提交于 2019-12-04 06:35:31
I have two sites, A and B . A consumes an API that B exposes, and B requires Windows authentication. Both sites live in Domain D . The API is consumed via HttpClient , and when site A is run locally, under my domain account (which is in Domain P ), access is granted. In this case, HttpClient is instantiated like so: using(var client = new HttpClient(new HttpClientHandler { UseDefaultCredentials: true })) When A is deployed to a testing server, the above results in a 401 Unauthorized response. The application pool on the testing server is running under a service account in domain D . When

windows authentication in windows features in iis

孤人 提交于 2019-12-04 04:56:11
问题 I'm having an issue setting up Windows Authentication in IIS 7 on my Windows 7 machine. I know by default this option isn't applied by IIS so you have to tick the Windows Authentication tickbox in Windows Features->Internet Information Services->World Wide Web Services->Security. However, under Security there are only 4 options, which are, i) Basic Authentication ii) IP Security iii) Request Filtering iv) URL Authorization Is there any way of getting the Windows Authentication option here?

Programmatically enable or disable anonymous authentication in IIS

て烟熏妆下的殇ゞ 提交于 2019-12-04 04:38:19
问题 I have a web application and I need to provide its users the option to switch login method from FormsAuth to WindowsAuth. I managed to change the web.config file via code: Configuration config = WebConfigurationManager.OpenWebConfiguration(Url.Content("~")); AuthenticationSection auth = ((AuthenticationSection)(config.SectionGroups["system.web"].Sections["authentication"])); auth.Mode = AuthenticationMode.Windows; // Or Forms if I want to. config.Save(); But the problem is, when I use

Using windows authentication in asp.net with c#

你。 提交于 2019-12-04 03:27:05
问题 Im trying to understand how windows authentication works and how to implement it. Ive read quite a few articles and watched some quite length videos on youtube but i still cant my head around what needs to be added to my web.config file/ index.aspx page to make it work properly. Here is the index.aspx page: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data.SqlClient; using System