473,396 Members | 1,938 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,396 software developers and data experts.

ASP.NET Impersonation to access Oracle database...

Hi all,

I am trying to work out how I can use impersonation to connect to an Oracle
9i database such that I can avoid sending a clear text username and password
to the Oracle server.

We are using Windows 2000 and IIS 5.0. Currently the database and the
Webserver are running on the same machine (which I'll call MyMachineName)
Until now I have been using a connection string in the web.config file on an
IIS Web Server as follows:

<appSettings>
<add key="ConnectionString" value="Data Source=mydatabase;User
Id=scott;Password=tiger;Integrated Security=no;"/>
</appSettings>

This works fine but it is not a satisfactory long term solution.
I have tried to use Impersonation so that the UserId and Password can be
stored in the registry on the Web Server to achieve the same result. I have
performed these steps on the IIS Web Server:

From the command line:
aspnet_setreg.exe -k:SOFTWARE\myWebService\identity -u:"scott" -p:"tiger"
Added to web.config:
<identity impersonate="true"
userName="registry:HKLM\SOFTWARE\myWebService\iden tity\ASPNET_SETREG,userNam
e"
password="registry:HKLM\SOFTWARE\myWebService\iden tity\ASPNET_SETREG,passwor
d"
/>

I have kept the appSettings section but removed the username and password:
<appSettings>
<add key="ConnectionString" value="Data Source=mydatabase;Integrated
Security=no;"/>
</appSettings>

Used regedt32.exe to grant permissions for the ASP.NET account on these
registry keys. ie:
Click on the HKEY_LOCAL_MACHINE\SOFTWARE\myWebService\ subkey
On the Security menu, click Permissions
Click Add
In the "Look In" combo box (which appears in a Win2K environment) select the
machine name (not the domain name because the ASPNET user has not been added
to our domain)

The user MyMachineName\ASPNET has now been granted permissions on the
ASP.NET account.

The web service is configured to use anonymous access.

At this point I tried to navigate to the Virtual Directory
(...service1.asmx) using Internet Explorer and received this error message:
Configuration error ... Error from the operating system ... "A required
privilege is not held by the client"

Then I read that a possible workaround is to change the Local Policies as
follows:
Start,Settings,Control Panel,Administrative Tools,Local Security
Policy,Local Policies,User Rights Assignment,Act as part of the operating
system,
Add,MyMachineName\ASPNET

Unfortunately I am still getting the same error ... "A required privilege is
not held by the client"
I also tried modifying the machine.config file processModel section with
userName="SYSTEM" and password="AutoGenerate"

Does anyone have any suggestions to either fix the problem or to try an
alternative approach?

I am worried about the possibility that using a 3rd party product (Oracle)
has compromised the likelihood of resolving the problem.
Do I need to set up ASPNET as a domain user?
Do I need to further change the appSettings section of the web.config file?
Does ASPNET have to be defined as a database user ? (currently it is not)

Many thanks,

DJ

Nov 19 '05 #1
1 2143
The error you are getting is because User Id=scott is not an authorized
UserID to the desktop (or server) where you are running the application. If
you were to use a userId and password that is allowed on both the desktop and
on the Oracle server then you will not get that error.
---

"Top Poster" wrote:
Hi all,

I am trying to work out how I can use impersonation to connect to an Oracle
9i database such that I can avoid sending a clear text username and password
to the Oracle server.

We are using Windows 2000 and IIS 5.0. Currently the database and the
Webserver are running on the same machine (which I'll call MyMachineName)
Until now I have been using a connection string in the web.config file on an
IIS Web Server as follows:

<appSettings>
<add key="ConnectionString" value="Data Source=mydatabase;User
Id=scott;Password=tiger;Integrated Security=no;"/>
</appSettings>

This works fine but it is not a satisfactory long term solution.
I have tried to use Impersonation so that the UserId and Password can be
stored in the registry on the Web Server to achieve the same result. I have
performed these steps on the IIS Web Server:

From the command line:
aspnet_setreg.exe -k:SOFTWARE\myWebService\identity -u:"scott" -p:"tiger"
Added to web.config:
<identity impersonate="true"
userName="registry:HKLM\SOFTWARE\myWebService\iden tity\ASPNET_SETREG,userNam
e"
password="registry:HKLM\SOFTWARE\myWebService\iden tity\ASPNET_SETREG,passwor
d"
/>

I have kept the appSettings section but removed the username and password:
<appSettings>
<add key="ConnectionString" value="Data Source=mydatabase;Integrated
Security=no;"/>
</appSettings>

Used regedt32.exe to grant permissions for the ASP.NET account on these
registry keys. ie:
Click on the HKEY_LOCAL_MACHINE\SOFTWARE\myWebService\ subkey
On the Security menu, click Permissions
Click Add
In the "Look In" combo box (which appears in a Win2K environment) select the
machine name (not the domain name because the ASPNET user has not been added
to our domain)

The user MyMachineName\ASPNET has now been granted permissions on the
ASP.NET account.

The web service is configured to use anonymous access.

At this point I tried to navigate to the Virtual Directory
(...service1.asmx) using Internet Explorer and received this error message:
Configuration error ... Error from the operating system ... "A required
privilege is not held by the client"

Then I read that a possible workaround is to change the Local Policies as
follows:
Start,Settings,Control Panel,Administrative Tools,Local Security
Policy,Local Policies,User Rights Assignment,Act as part of the operating
system,
Add,MyMachineName\ASPNET

Unfortunately I am still getting the same error ... "A required privilege is
not held by the client"
I also tried modifying the machine.config file processModel section with
userName="SYSTEM" and password="AutoGenerate"

Does anyone have any suggestions to either fix the problem or to try an
alternative approach?

I am worried about the possibility that using a 3rd party product (Oracle)
has compromised the likelihood of resolving the problem.
Do I need to set up ASPNET as a domain user?
Do I need to further change the appSettings section of the web.config file?
Does ASPNET have to be defined as a database user ? (currently it is not)

Many thanks,

DJ

Nov 19 '05 #2

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

Similar topics

2
by: Seung Y. Kim | last post by:
Hi everyone. I am having a big performance issue with my ASP application with Oracle database. The application itself is a very database-generic one, so I can switch from Access to SQLServer...
0
by: Daisy | last post by:
To empower your .NET web services with the Oracle Database, download Oracle Data Provider for .NET (ODP.NET) from : http://otn.oracle.com/tech/windows/odpnet/index.html Try out the new features...
1
by: bala | last post by:
Hi Access Gurus The MS Access DB (MS Access 2002 Database) which is currently serving as the backend Database to MS Access (MS Access 2002/XP) frontend needs to be converted to Oracle 8i Backend...
1
by: kumarmanoj_pat | last post by:
hi, i am trying to insert a picture in my database through SQL. i have already tried but could not get success. if any one know about this then please helpnme.
2
by: Mark Brown | last post by:
I'm trying to access an Oracle database vb.net. I found several examples. I tried following each one, but I get the same error no matter what I try. I don't really understand what the error means...
3
by: =?Utf-8?B?R3V5IENvaGVu?= | last post by:
Hi all I have a problem running my program as a service. When it runs as a desktop program, it has access to oracle database. When it runs as a service it returns an error: Oracle client and...
0
by: Jack | last post by:
Training Classes for Oracle10g, 9i, 8i Certification training in Oracle10g and 9i: DBA, Developer, Discoverer. training conducted at your location worldwide. Courseware licensing also available....
0
by: Winder | last post by:
Training Classes for Oracle10g, 9i, 8i Certification training in Oracle10g and 9i: DBA, Developer, Discoverer. training conducted at your location worldwide. Courseware licensing also available....
23
by: Gloops | last post by:
Hello everybody, Is anyone able to give me some indications about how to develop an Access interface for an Oracle database ? I dispose of Access 2003 (11.6566.8107) SP2, Oracle 9i 9.2.0.1.0...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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
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
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...

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.