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

sql server connection

Hi all,
I am using windows authentication to create a sql connection using
following connection string stored in web.config.
<add key="GoldmineConnectString"

value="server=(local);initial catalog=pubs;Integrated Security=SSPI" />

But when I run the application, the application is trying to connect to the
database as MACHINENAME/ASPNET user. I would like it to use a special
windows account I have created for my application called MYAPPUSER. How can
I make the application to use this windows account to connect to the sql
server?

Thanks.

Nikhil
Nov 18 '05 #1
4 1504
You could use impersonation to have ASP.NET run under the new windows
account you've created.

For example, you can add a line similar to this to your web.config file:
<identity impersonate="true" userName="domain\MyAppUser">
password="password"/>

Here's more info on impersonation:
http://msdn.microsoft.com/library/de...ersonation.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net

"Nikhil Patel" <do*******@nospaml.com> wrote in message
news:ON****************@TK2MSFTNGP11.phx.gbl...
Hi all,
I am using windows authentication to create a sql connection using
following connection string stored in web.config.
<add key="GoldmineConnectString"

value="server=(local);initial catalog=pubs;Integrated Security=SSPI" />

But when I run the application, the application is trying to connect to
the database as MACHINENAME/ASPNET user. I would like it to use a special
windows account I have created for my application called MYAPPUSER. How
can I make the application to use this windows account to connect to the
sql server?

Thanks.

Nikhil

Nov 18 '05 #2
HI Nikhil:

Two options available are:

1) Configure impersonation in web.config with the account and password
See:
http://msdn.microsoft.com/library/de...ersonation.asp

2) Change the ASP.NET process model in machine.config so the entire
worker process runs as your MYAPPUSER account.
See:
http://msdn.microsoft.com/library/de...onIdentity.asp
HTH,

--
Scott
http://www.OdeToCode.com/

On Mon, 4 Oct 2004 12:32:08 -0400, "Nikhil Patel"
<do*******@nospaml.com> wrote:
Hi all,
I am using windows authentication to create a sql connection using
following connection string stored in web.config.
<add key="GoldmineConnectString"

value="server=(local);initial catalog=pubs;Integrated Security=SSPI" />

But when I run the application, the application is trying to connect to the
database as MACHINENAME/ASPNET user. I would like it to use a special
windows account I have created for my application called MYAPPUSER. How can
I make the application to use this windows account to connect to the sql
server?

Thanks.

Nikhil


Nov 18 '05 #3
Hi Steve,
Thanks for your reply. The reason why I am using windows authentication
is that I don't want to write password in the web.config. So your method
will not work in this case. I don't know too much about ASP.Net Security and
Data Access Security. I was reading MSDN regarding these topics and I found
the following section:

Avoid impersonation in the middle tier: Windows authentication requires a

Windows account for database access. Although it might seem logical to use

impersonation in the middle tier, avoid doing so because it defeats
connection

pooling and has a severe impact on application scalability.

To address this problem, consider impersonating a limited number of Windows

accounts (rather than the authenticated principal) with each account
representing

a particular role.

For example, you can use this approach:

1. Create two Windows accounts, one for read operations and one for write

operations. (Or, you might want separate accounts to mirror
applicationspecific

roles. For example, you might want to use one account for Internet

users and another for internal operators and/or administrators.)

2. Map each account to a SQL Server database role, and establish the
necessary

database permissions for each role.

3. Use application logic in your data access layer to determine which
Windows

account to impersonate before you perform a database operation.

Note: Each account must be a domain account with Internet Information
Services (IIS) and

SQL Server in the same domain or in trusted domains. Or, you can create
matching accounts

(with the same name and password) on each computer.
So I created a special windows account and gave it database permissions to
execute stored procedures. I am not sure whether I need this account or
should I just give database permissions to ASPNET account? I couldn't find
any practical example on what accounts I need to create,etc,etc. What are
the best practices?

Thanks.
Nikhil

"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:ei**************@TK2MSFTNGP10.phx.gbl...
You could use impersonation to have ASP.NET run under the new windows
account you've created.

For example, you can add a line similar to this to your web.config file:
<identity impersonate="true" userName="domain\MyAppUser">
password="password"/>

Here's more info on impersonation:
http://msdn.microsoft.com/library/de...ersonation.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net

"Nikhil Patel" <do*******@nospaml.com> wrote in message
news:ON****************@TK2MSFTNGP11.phx.gbl...
Hi all,
I am using windows authentication to create a sql connection using
following connection string stored in web.config.
<add key="GoldmineConnectString"

value="server=(local);initial catalog=pubs;Integrated Security=SSPI" />

But when I run the application, the application is trying to connect to
the database as MACHINENAME/ASPNET user. I would like it to use a special
windows account I have created for my application called MYAPPUSER. How
can I make the application to use this windows account to connect to the
sql server?

Thanks.

Nikhil


Nov 18 '05 #4
You can encrypt this.

See :
http://support.microsoft.com/default...b;en-us;329290

Patrice

--

"Nikhil Patel" <do*******@nospaml.com> a écrit dans le message de
news:el**************@TK2MSFTNGP15.phx.gbl...
Hi Steve,
Thanks for your reply. The reason why I am using windows authentication
is that I don't want to write password in the web.config. So your method
will not work in this case. I don't know too much about ASP.Net Security and Data Access Security. I was reading MSDN regarding these topics and I found the following section:

Avoid impersonation in the middle tier: Windows authentication requires a

Windows account for database access. Although it might seem logical to use

impersonation in the middle tier, avoid doing so because it defeats
connection

pooling and has a severe impact on application scalability.

To address this problem, consider impersonating a limited number of Windows
accounts (rather than the authenticated principal) with each account
representing

a particular role.

For example, you can use this approach:

1. Create two Windows accounts, one for read operations and one for write

operations. (Or, you might want separate accounts to mirror
applicationspecific

roles. For example, you might want to use one account for Internet

users and another for internal operators and/or administrators.)

2. Map each account to a SQL Server database role, and establish the
necessary

database permissions for each role.

3. Use application logic in your data access layer to determine which
Windows

account to impersonate before you perform a database operation.

Note: Each account must be a domain account with Internet Information
Services (IIS) and

SQL Server in the same domain or in trusted domains. Or, you can create
matching accounts

(with the same name and password) on each computer.
So I created a special windows account and gave it database permissions to
execute stored procedures. I am not sure whether I need this account or
should I just give database permissions to ASPNET account? I couldn't find
any practical example on what accounts I need to create,etc,etc. What are
the best practices?

Thanks.
Nikhil

"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:ei**************@TK2MSFTNGP10.phx.gbl...
You could use impersonation to have ASP.NET run under the new windows
account you've created.

For example, you can add a line similar to this to your web.config file:
<identity impersonate="true" userName="domain\MyAppUser">
password="password"/>

Here's more info on impersonation:
http://msdn.microsoft.com/library/de...ersonation.asp
--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net

"Nikhil Patel" <do*******@nospaml.com> wrote in message
news:ON****************@TK2MSFTNGP11.phx.gbl...
Hi all,
I am using windows authentication to create a sql connection using
following connection string stored in web.config.
<add key="GoldmineConnectString"

value="server=(local);initial catalog=pubs;Integrated Security=SSPI" />

But when I run the application, the application is trying to connect to
the database as MACHINENAME/ASPNET user. I would like it to use a special windows account I have created for my application called MYAPPUSER. How
can I make the application to use this windows account to connect to the sql server?

Thanks.

Nikhil



Nov 18 '05 #5

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

Similar topics

13
by: Fortepianissimo | last post by:
Here is the situation: I want my server started up upon connection. When the first connection comes in, the server is not running. The client realizes the fact, and then starts up the server and...
2
by: Dicky Cheng | last post by:
Hi, I am using .net remoting technology. I set up a .net remoting client and server in IIS. When the client calls the server, the server will run a long duration method (30-60seconds). I have a...
5
by: Fred Zuckerman | last post by:
Hello All, After reading in this group about the preference for connecting to a SQL Server using a connection string instead of a DSN file, I have done just that. BUT, I cannot update my data....
12
by: RKay | last post by:
I have a Win2k server running SQL Server 2000. On that box I built a working web service that pulls data from the database. One of the services available simply accepts an ado.net connection string...
0
by: Suresh | last post by:
Hi Guys I have Db2 server installed on remote server. i am connecting to that remote server by using VPN. I want to connect that remote DB2 server instance using my local machine DB2...
14
by: Marcus | last post by:
I have a function that simply returns TRUE if it can connect to a particular Sql Server 2005 express, or FALSE if it cannot. I am getting some strange error codes returned when the computer that...
25
by: _DD | last post by:
I'd like to include a 'Test Connection' button in an app, for testing validity of a SQL connection string. I'd prefer to keep the timeout low. What is the conventional way of doing this?
17
by: Anil Gupte | last post by:
I am using the following to try to connect to the database, but it does not seem to be working. Dim sConnString sConnString = "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security...
39
by: alex | last post by:
I've converted a latin1 database I have to utf8. The process has been: # mysqldump -u root -p --default-character-set=latin1 -c --insert-ignore --skip-set-charset mydb mydb.sql # iconv -f...
5
by: Cirene | last post by:
I just deployed my new ASP.NET (3.5 FW) site to the hosting company I'm using, webhost4life. NOTE: I HAVE deployed other SQL Server sites to the same account with no issues. Now I'm getting...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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?
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
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,...
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.