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

De-impersonate to connect to SQL as Machine Account

Hi there,

My ASP.NET application has impersonation turned on in web.config as
follows:

<identity impersonate="true" />

However, now I need to connect to a SQL database. Rather than allowing
every single AD user access to the database, I'd like to connect to SQL
server as the computer account, e.g. MYWEBSERVER$. This should simplify
SQL security management, but most importantly, enable SQL connection
pooling.

If I turn impersonation off for the entire application (in web.config)
I get the desired result, i.e. the application runs as NETWORK SERVICE
user (IIS AppPool user), and I am able to connect to SQL -- good.
However this affects other parts of the application that require
impersonation to be turned on.

There doesn't seem to be a way to turn impersonation on or off per
page.

Is there a way to "temporarily" turn off impersonation? Or any other
way to connect to SQL and pass NETWORK SERVICE as the credentials?

Thanks,
-Oleg.

May 30 '06 #1
1 2197
see RevertToSelf in the windows api. because ado.net pooling is lazy about
connecting, you will have to surround all sql statements with RevertToSelf
and restore impersonation statements.
-- bruce (sqlwork.com)

"Oleg Ogurok" <Ol*********@gmail.com> wrote in message
news:11**********************@j73g2000cwa.googlegr oups.com...
Hi there,

My ASP.NET application has impersonation turned on in web.config as
follows:

<identity impersonate="true" />

However, now I need to connect to a SQL database. Rather than allowing
every single AD user access to the database, I'd like to connect to SQL
server as the computer account, e.g. MYWEBSERVER$. This should simplify
SQL security management, but most importantly, enable SQL connection
pooling.

If I turn impersonation off for the entire application (in web.config)
I get the desired result, i.e. the application runs as NETWORK SERVICE
user (IIS AppPool user), and I am able to connect to SQL -- good.
However this affects other parts of the application that require
impersonation to be turned on.

There doesn't seem to be a way to turn impersonation on or off per
page.

Is there a way to "temporarily" turn off impersonation? Or any other
way to connect to SQL and pass NETWORK SERVICE as the credentials?

Thanks,
-Oleg.

May 30 '06 #2

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

Similar topics

0
by: Michael Dyson | last post by:
M. Michael DYSON DIRECTEUR-ADJOINT SOCIÉTÉ DE SÉCURITÉ SARL. TEL.00229 20 21 80 Cotonou République du Bénin Email:michaeldyson2005@latinmail.com Bonjour . Je sais que mon message sera d’une...
1
by: crow | last post by:
http://www.pagina12.com.ar/diario/elpais/1-72984-2006-09-14.html Por Miguel Bonasso Desde La Habana Me había preparado para verlo, pero la realidad fue mucho más fuerte. Incluso le llevaba de...
1
by: gandalf | last post by:
CON LA PASION DE SIEMPRE HABLO DE CHAVEZ, DE LA MEDICINA CUBANA... Y DE SU PROPIA MUERTE Relato de la nueva gran batalla de Fidel El líder cubano mostró cómo evoluciona su recuperación en el...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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...

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.