473,480 Members | 1,755 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

how to have component run in security context of windows user?

I have an application/component that updates an individual's active directory information. The current application finds the active directory entry via the following..

Dim entry As DirectoryEntry = New DirectoryEntry("LDAP://" & m_DomainName, m_Username, m_Password, AuthenticationTypes.FastBind
Dim ds As New DirectorySearcher(entry
Dim filter As String = "(sAMAccountName=" & "joeuser" & ")
ds.Filter = filte
Dim results As SearchResultCollectio
Dim searchResults As SearchResul
searchResults = ds.FindOn
Dim user As DirectoryEntry = searchResults.GetDirectoryEntry(
user.Properties("description").Value = "Goat Farmer
user.CommitChanges(

The problem..
Only the employee has rights to update their AD information. How can I create the "entry" with the correct permissions of the user running the web application? This is a web application and I currently use forms authentication on the existing web application

Any help would be very much appreciated
dave
Jul 21 '05 #1
2 3421
Hello Dave,

Thanks for your post. As I understand, you want to impersonate a user in
your ASP .NET Web application in order to updates an individual's active
directory information. Please correct me if there is any misunderstanding.
Based on my experience and research, you will need to perform the following
steps:

1. Make sure that the ASP .NET Process Identity is set to System. The
Machine.config file looks like below:
<system.web>
<processModel enable="true"
userName="System"
password="AutoGenerate"/>
</system.web>

The following MSDN article describes ASP.NET Process Identity in detail:
http://msdn.microsoft.com/library/de...us/cpguide/htm
l/cpconConfiguringASPNETProcessIdentity.asp

2. Go to "Control Panel" -> "Administrative Tools" -> "Internet Information
Services Manager", choose the corresponding Web Site, open its Properties
page, choose "Directory Security", uncheck "Enable anonymous access" in
"Authentication and access control".

3. Impersonate the authenticating user in your code:

Dim impersonationContext As
System.Security.Principal.WindowsImpersonationCont ext
Dim currentWindowsIdentity As System.Security.Principal.WindowsIdentity

currentWindowsIdentity = CType(User.Identity,
System.Security.Principal.WindowsIdentity)
impersonationContext = currentWindowsIdentity.Impersonate()

'Insert your code that runs under the security context of the
authenticating user here.

impersonationContext.Undo()

Please refer to the following KB article for detailed information:

INFO: Implementing Impersonation in an ASP.NET Application
http://support.microsoft.com/?ID=306158

Please check it on your side, and let me know the result.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #2
Hello Dave,

Thanks for your post. As I understand, you want to impersonate a user in
your ASP .NET Web application in order to updates an individual's active
directory information. Please correct me if there is any misunderstanding.
Based on my experience and research, you will need to perform the following
steps:

1. Make sure that the ASP .NET Process Identity is set to System. The
Machine.config file looks like below:
<system.web>
<processModel enable="true"
userName="System"
password="AutoGenerate"/>
</system.web>

The following MSDN article describes ASP.NET Process Identity in detail:
http://msdn.microsoft.com/library/de...us/cpguide/htm
l/cpconConfiguringASPNETProcessIdentity.asp

2. Go to "Control Panel" -> "Administrative Tools" -> "Internet Information
Services Manager", choose the corresponding Web Site, open its Properties
page, choose "Directory Security", uncheck "Enable anonymous access" in
"Authentication and access control".

3. Impersonate the authenticating user in your code:

Dim impersonationContext As
System.Security.Principal.WindowsImpersonationCont ext
Dim currentWindowsIdentity As System.Security.Principal.WindowsIdentity

currentWindowsIdentity = CType(User.Identity,
System.Security.Principal.WindowsIdentity)
impersonationContext = currentWindowsIdentity.Impersonate()

'Insert your code that runs under the security context of the
authenticating user here.

impersonationContext.Undo()

Please refer to the following KB article for detailed information:

INFO: Implementing Impersonation in an ASP.NET Application
http://support.microsoft.com/?ID=306158

Please check it on your side, and let me know the result.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
311
by: dave | last post by:
I have an application/component that updates an individual's active directory information. The current application finds the active directory entry via the following.. Dim entry As DirectoryEntry...
0
1221
by: Jiho Han | last post by:
This seems like a often-asked topic. I created a windows service and installed it on my workstation. The application basically goes out and "receieves" messages from a queue on a remote server....
87
5248
by: Sony Music CDs install Malware | last post by:
Whether you are a web surfer or a C++ developer, if you use Windows be cautioned about SONY music CDs. They contain 'viewer' type software that is actually a trojan horse for a "rootkit". The...
5
3937
by: John Lee | last post by:
Hi, I have a component with some static public methods and is it possible from inside my method to decide if my component is invoked by an ASP.NET application (such as web service) or a windows...
0
1393
by: Jon Pope | last post by:
Occasionally, I see the following error whenever I close a form which is being displayed with the ShowDialog() method within my C# app: Error message: External component has thrown an exception....
9
2068
by: Stan | last post by:
Here is my scenario: Web server ------------ Framework 1.1 Application proxy for the serviced component Component server ------------------- Framework 1.0
2
2226
by: KaNos | last post by:
Hello world, I've made a webservice (c# v2) to install in a server IIS 6 on a Windows 2000 last SP. We can use the webservice in local, throw the pages wich present the methods, with a windows...
1
6068
by: novicedlh | last post by:
Hello, I am creating a webservice that collects user information and stores it in a database. Since the user information contains sensitive data like SSN I am planning to use WS-Security (WSE...
4
1686
by: Kerem Gümrükcü | last post by:
Hi, the topic of this thread implies the question. Why does this happen. What can i do against it. App runs in admin context, then ii switch to user standard user context and open a form with...
3
1990
by: RedHair | last post by:
I use the Form Authentication and Role base security to secure one ASP.NET 3.5 appication. Below are security settings in web.config <location path="testAdmin.aspx"> <system.web>...
0
7044
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6908
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7045
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6741
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
6944
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4782
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4483
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2995
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
182
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.