asp.net - Steps to enable double-hop delegation in IIS7 windows 2008 -
my asp.net web application uses windows authentication on our intranet. want able make server-side http request server on same domain requires windows authentication.
i've followed instructions on temporarily impersonating authenticated user when making additional request here:
http://msdn.microsoft.com/en-us/library/ff647404.aspx
using code this:
using system.security.principal; // obtain authenticated user's identity windowsidentity winid = (windowsidentity)httpcontext.current.user.identity; windowsimpersonationcontext ctx = null; try { // start impersonating ctx = winid.impersonate(); // impersonating // access resources using identity of authenticated user var request = webrequest.create("http://intranet/secureapp"); request.credentials = credentialcache.defaultcredentials; var response = request.getresponse(); using (var streamreader = new streamreader(response.getresponsestream())) { response.write(streamreader.readtoend()); } } // prevent exceptions propagating catch { } { // revert impersonation if (ctx != null) ctx.undo(); } // running under default asp.net process identity
but, unfortunately, 401 unauthorized error.
do need configure our webserver active directory allow delegate autenticated user (could 1 of 200 users, don't want have 200 times :))? if so, can tell me how this?
there several steps configuring kerberos/delegation windows.
first, need configure asp.net use delegation. assume have configured in web.config.
then need configure asp.net service account delegation. have create spn.
then enable delegation iis server , account in active directory.
step step instructions provided here: http://msdn.microsoft.com/en-us/library/ms998355.aspx follow steps 1-3.
Comments
Post a Comment