473,659 Members | 3,420 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP.NET impersonation won't change locking user

3 New Member
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 WindowsPrincipa l 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 2094
kenobewan
4,871 Recognized Expert Specialist
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
HugoVallejo
3 New Member
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 WindowsPrincipa l 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
HugoVallejo
3 New Member
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.Sq lClient.SqlClie ntPermission [.....]' failed exception and then with the odbc connection. After adding the permission sets the problem was solved. However, I couldn't solved the SecurityExcepti on 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
2562
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 problem is that even when it is configured to run under a certain identity through Web.config, the impersonation is not carried through to COM library. Consequently, the code in COM object runs under a local account and any code that needs to access...
3
2767
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 an Asp.Net site to be able to open/access a file that's on an Smb share (ie. "Windows Share", "NetBios Share", etc.). I cannot use the "ASPNET" username; that's a bad route to take anyhow (got to mess with the "automatic" password settings and...
1
1877
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 Multi-threading to spawn off an asynchronous process, as it takes quite long to return. How could I get the worker thread to runas the same impersonated user on ASP.NET?
4
1786
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 database to check I created local users and assigned each of them a different default DB in SQL Server, then, in the windows service I impersonate each user and then access the DB, when the connection to the DB is made, the default DB for the...
3
1468
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 Authentication. In order to make this work, we have to impersonate a user account with access to the web service and set the Credential property on the web service proxy object to DefaultCredentials before we actually make the web service call. If we don't...
8
3518
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 used to handle its children. 2. Create a new process (either by CreateProcessW() or by CreateProcessWithLogonW() for user impersonation).
0
1512
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 against an active directory and the windows identity is retrieved (and stored in the session!!) 3. user is impersonated using the windows identity (thread is now running under the identity of the user)
0
1953
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 the ini on the client's PC. After the program has ended the control looks in a client side temp folder (specified by the ini file) for an image created by the executed program. If the image is there, then the control moves the file to a public folder...
7
1847
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 editing a case, for example changing the persons info, editing the violations/charges they have, etc... I don't want another user to have pulled the same case and one of them clicks Update or Save before the other. So the case is locked for...
0
8428
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8851
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8748
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8531
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8628
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6181
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4175
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1978
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.