How to change the account that ASP.NET uses

M

Mr.KisS

Hi,

How to change the account that ASP.NET uses for this
virtual directory to one that has rights to the SQL Server
box.

Or how to use impersonation set in the Web.config file for
the asp application, referring to an account that has
rights to the SQL Server box.

Pls step by step ;)

Regards.
 
G

Guest

i've done that (i've no password in my account):
<identity impersonate="true" userName="KLEO\Lazhar"
password="" />
<authentication mode="Windows"/>

But i get this error message :

Server Error in '/myapp' Application.
--------------------------------------------------------------------------------

Configuration Error
Description: An error occurred during the processing of a
configuration file required to service this request. Please
review the specific error details below and modify your
configuration file appropriately.

Parser Error Message: Could not create Windows user token
from the credentials specified in the config file. Error
from the operating system 'Erreur non spécifiée '


Regards.
 
M

Mr.KisS

Might i have just to give the rights to ASPNET user account
in SQL Server, no?

But how could i make it ? (sql server 2005 express)

Resgards.
-----Original Message-----
You might not have appropriate permissions to run the Application.

Check the below link to create Custom Account to run ASP
..Net and specify this account in Machine.config or specify
it at Application Pool Identity.
 
S

Scott Allen

There are three stored procedures you'll need to execute. You can
connect with Visual Studio, or from the command line with SQLCMD.

Feel free to msg if you need help with the above. Once you are
connected you'll need to exec sp_grantlogin 'machinename\ASPNET, which
allows ASPNET to login.

Use exec sp_grantdbaccess 'machinename\ASPNET' to give the ASPNET
account access to a database, and exec sp_addrolemember
'rolename','machinename\ASPNET' to add the login to a role, like
'public', or 'db_datareader'.

HTH,
 
M

M. Zeeshan Mustafa

have a look at:
http://support.microsoft.com/?id=307626

solution here:
http://msdn.microsoft.com/webservic...l=/library/en-us/dnnetsec/html/SecNetHT01.asp
--
Hope this helps,
Zeeshan Mustafa, MCSD


Might i have just to give the rights to ASPNET user account
in SQL Server, no?

But how could i make it ? (sql server 2005 express)

Resgards.
-----Original Message-----
You might not have appropriate permissions to run the Application.

Check the below link to create Custom Account to run ASP
..Net and specify this account in Machine.config or specify
it at Application Pool Identity.
 
M

Mr.KisS

Ok, and for :

grantdbaccess , what fixed database role must i give for
asp.net? it's for normal use : select, update, execeute
stocked procedures, insett, alter, etc...

Which one?

db_owner
db_accessadmin
db_securityadmin
db_ddladmin
db_backupoperator
db_datareader
db_datawriter
db_denydatareader
db_denydatawriter

Regards.
 
M

Mr.KisS

i have gave 'db_creator' role to KLEO\ASPNET but now i get
this error message or, the file wizou.mdf exists :/ Any idea?

Cannot open database 'C:\Program Files\Microsoft SQL
Server\MSSQL.1\MSSQL\Data\wizou.mdf' requested by login.
Login fails. Login failed for user 'KLEO\ASPNET'.

Description: An unhandled exception occurred during the
execution of the current web request. Please review the
stack trace for more information about the error and where
it originated in the code.

Exception Details: System.Data.SqlClient.SqlException:
Cannot open database 'C:\Program Files\Microsoft SQL
Server\MSSQL.1\MSSQL\Data\wizou.mdf' requested by login.
Login fails. Login failed for user 'KLEO\ASPNET'.

Any ideas?

Best Regards, thanks for helping me :)
 
S

Scott Allen

It depends a bit on the permissions given to the objects you need to
access, but generally, db_datareader and db_datawriter will do the
trick.
 
M

Mr.KisS

"Is the ASPNET login the login that created the database?"
=> Sorry, but i dont understand :/
No login has been created?

Which login are you speaking, there is no one? I dont know
the password of ASPNET account, i have never gave one do...

Regards.
 
S

Scott Allen

Sorry for the confusion, let me back up a step.

You might need to sp_grantdbaccess to ASPNET for the new database and
put it in a database role, like db_reader / db_writer.
 
M

MR.KisS

no :/ i've put it :

1> sp_grantdbaccess 'KLEO\ASPNET', 'ASPNET'
2> go
Msg 15151, Level 16, State 1, Server KLEO\SQLEXPRESS, Line 1
Cannot find the user 'ASPNET', because it does not exist or
you do not have perm
ission.
Msg 2759, Level 16, State 1, Server KLEO\SQLEXPRESS, Line 1
CREATE SCHEMA failed due to previous errors.

i'm hopeless, i dont know what i have to do :/
(if u have msn : (e-mail address removed), better)

Regards.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top