473,395 Members | 1,616 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

how can I tell if impersonation is working in ASP.Net web app?

In order for my ASP.Net application to access a database using my
privileged account, I was told to set up an app using Integrated
Windows authentication and to use impersonation. I set the app to use
Integrated Windows authentication and disabled anonymous access, and
made sure the application was set to
<authentication mode="Windows" />
in Web.config. I know I got that part working because when I access an
..aspx page with

User name: <%=User.Identity.Name%>

in it, it displays this when I load it in the browser:

User name: BENNETTS_3_2002\Owner

(where "BENNETTS_3_2002" is my machine name). I have also added this
tag inside the <system.web> tag in the Web.config file:

<identity impersonate="true"/>

However, is there any way to verify that now the code in the codebehind
file is running under my identity, i.e. that the impersonation is
working?

The hack that I implemented was to put this code into: Page_Load:

System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = "C:\\Program Files\\Windows
NT\\Accessories\\wordpad.exe";
p.Start();

and then after loading the page, I use Task Manager to see that it did
indeed launch a new instance of Wordpad.exe -- except that Wordpad.exe
is running under the "ASPNET" username, instead of my username. This
seems to suggest that impersonation is not, in fact working, and the
code is still running under the ASPNET username instead of under my
account. What can I check to see if I did something wrong?

Thanks!

-Bennett

Jan 11 '06 #1
1 2001
HttpContext.User returns the original client user, and is the same no
matter impersonate is on or off. WindowsIdentity.GetCurrent() returns
the current Win32 user.

See http://support.microsoft.com/?id=306158.

You may also need to configure delegation to access resource on servers
other than the IIS one, see
http://support.microsoft.com/default...b;en-us;810572.

Thi

Jan 11 '06 #2

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

Similar topics

5
by: seandiaz | last post by:
I have a question concerning impersonation - I created an app using impersonation that runs fine on my local machine. I also ran the app on two other developer machines and it runs fine. When I...
4
by: Bonj | last post by:
Hi I would like to know how to use impersonation, in order to write to a file on a network share. The user will be logging on to this web app, and will then click a button which will write to a...
2
by: Tom Wells | last post by:
My server admin and I are trying to figure out how to get impersonation working to be able to upload a file from the client browser thru the web server to a network file server. My network ID for...
15
by: Patrick | last post by:
I set my web.config as follows: <authentication mode="Windows" /> <identity impersonate="true" /> Logon to my ASP.NET website as a user who can authenticate to the target database. 1) Works...
1
by: William Oliveri | last post by:
Hello all, I have a working example of Impersonation where I receive a token and a true response for a specific user. However, if I try to access a drive that has only that user's permission to...
11
by: Phil | last post by:
Hi, I've currently setup a local user as described in: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnne...
0
by: Elroyskimms | last post by:
I need to execute a batch file via ASP.Net. In my VB.Net code, I'm using System.Diagnostics.Process to call the batch file and its appropriate command line arguments. I'm using...
0
by: Mike | last post by:
Hi all, Hopefully someone will be able to help with this issue. I have an ASP.Net application that is trying to extract frames from .avi and .wmv files to create thumbnails. The media files are...
0
by: ChopStickr | last post by:
I have a custom control that is embedded (using the object tag) in an html document. The control takes a path to a local client ini file. Reads the file. Executes the program specified in...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.