473,399 Members | 3,603 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,399 software developers and data experts.

ASP.NET impersonation won't change locking user

Hi everyone.
I've created an ASP.NET web site which uses a .NET assembly to read/write operations using an odbc driver. When a connection to the odbc database is made locking files are created, when the connection is closed those files are removed.

I tried the web site using VS2005 and it worked fine. Then I published it in IIS 5.1 (WIn XP SP2) but it didn't work. I thought because write permissions on the folder of the database. So I decided to impersonate, first I tried impersonation in the virtual directory and then programatically. In both cases I used a local administrator account. The problem is that even though the current WindowsPrincipal shows that the administrator account is being used by the assembly, the database files are locked by ASPNET anyway. I checked this using a handle utility which shows which process and users are locking a file. Becuase of that (I guess) the application is not working. Any operation against the odbc driver fails.

I've noticed that when I used VS2005 to test the web site, and also a windows application using the same assembly, the odbc database worker process is loadded when I call the Open method of the odbc connection. The process ends when the Close method is called. This is expected and in this case wevrything works fine. However, when I used the published web site, the worker process is loaded just an instant and then it is finished automatically without any reason . That's why after that point any statemente against the odbc driver will fail with the error "No valid application is running"

Any ideas about why this is happening? Why the locking user on the files is not the impersonated user? why the odbc database worker process lasts just an instant after the connection is Open? Is this becuase ASP.NET does not have permission to start a process?

Thanks! Any help would be appreciated
Jan 28 '09 #1
3 2077
kenobewan
4,871 Expert 4TB
Are you able to work with a newer version of IIS? This would make things easier otherwise start by checking web extensions. Are you using XP?
Jan 28 '09 #2
Hi kenobewan
Thanks for your answer.
I am using Windows XP SP2 IIS 5.1. I've tried the web site in three different computers with the same configuration but I got the same results. I will try it on a Win Server 2003 and see how it goes.

Anyway, why the ASPNET account is used to acquire the lock on the files if the code is running impersonation? Debuggin the code I can see that the current WindowsPrincipal and the current Thread user are all the admin account I used to impersonate, why is ASPNET acting?

Thanks. I'll post how it goes in the Win2003
Jan 28 '09 #3
I've tried the web site in a Win Server 2003 with IIS 6

I had some problems at the beginning with the security policy. I was getting Request for the permission of type 'System.Data.SqlClient.SqlClientPermission [.....]' failed exception and then with the odbc connection. After adding the permission sets the problem was solved. However, I couldn't solved the SecurityException I was getting due to the programmatic impersonation so I removed the impersonation from code and enabled the impersonation in the virtual directory (just for testing) using a local administrator account.

It worked! No problem at all. I guess I just need to fix the policy settings for the application in the server. However, I don't understantd why it does not work in my pc. Wha't's the difference? And again, why the seb site loades a process on behalf of the ASPNET account if impersonation is being used?

I need to do more development on my machine, how can I fix this?
Jan 29 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: Anil Krishnamurthy | last post by:
We have an ASP.NET application that uses COM objects through Interop. The web application requires access to network and database resources and hence, needs to impersonate a domain account. The...
3
by: Granger Godbold | last post by:
I've found a solution to this that I think I like, but I thought it wise to put it out for all to see so people could punch holes in it as they wished. (Is there a better way?) I want a page in...
1
by: Patrick | last post by:
I have an ASP.NET web service whose Web.Config is set to use impersonation <authentication mode="Windows" /> <identity impersonate="true" /> Within a Web Method, I want to use...
4
by: David Cablalero | last post by:
I have a windows service which every night checks a SQL Server database for some data and business rules. The application can access different DBs with the same structure, to tell the service which...
3
by: headware | last post by:
We have a web app that is running under Integrated Windows Authentication. It must consume to a web service we are publishing on another server, also running under Integrated Windows...
8
by: Marco Mechelli | last post by:
Hello, i'm facing with the following problem while using the Job API during an impersonation. I have a main process that needs to do the following: 1. Creates a new Job Object that will be...
0
by: Daniel Knöpfel | last post by:
Hello On our asp.net 2.0 website we impersonate every request to the identity of the user logged in. This works this way: 1. user logs in, providing username, password 2. user is authenticated...
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...
7
dlite922
by: dlite922 | last post by:
I need to do some sort of Locking mechanism at interface level, instead of DB Level. I know how MySQL table locking works, but that won't work in my scenerio. Requirements: When someone is...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
0
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...

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.