Getting User Info

G

Guest

I am currently pretty much teaching myself ASP.NET 1.1 since I can't get
classes through my work in order to migrate our web application over from ASP
3.0. We will be using VB.NET.

My problem is the SqlConnection. We have some heavy duty security wrapped up
between our web app and the database, and integral to this is the user
accounts in the SQL database. For those functions that require interaction or
input into the system, sprocs pull the current username from the
SUSER_SNAME() variable and match it to the appropriate roles.

I am just learning the SqlConnection, and have noticed that the only
SUSER_SNAME() I get is ASPNET. Even when I put Uid=uuuuu;Pwd=xxxxx in the
connection string it still comes back ASPNET. I figure this is default, but
if I can't get the actual username from the connection string I am passing in
the sproc, I will have to retool almost every single sproc that requires
elevated access in order to do the migration, and that is alot of sprocs.

Any ideas where I am going wrong? The connection string is standard, it
works fine except for the Uid (I have even tried User id=).

Thanks in advance.

Jim Hawley
 
S

S.M. Altaf [MVP]

If you set identity impersonate to true in your application, SQL Server
should recognize the user logged in.

In the web.config file, look for and change to this:


<identity impersonate="true" />HTH
-Alt
 
G

Guest

Sorry it took so long to get back to your answer. Thanks, exactly what I
needed. Appreciate it.

Jim
 
G

Guest

Ok, back again with almost the same problem. I changed the impersonation to
"true," which got rid of the requirement to give ASP.NET an account in the
database, but now the user is my Windows account. When I do a SUSER_SNAME() I
get back machinename/hawleyj (my Windows account name), where I want to get
james-hawley (my database account name). I included james-hawley in the
connection string as Uid, as well as User ID and it still comes back the same.

We use roles as part of our security system, and we need to be able to tell
who is it exactly executing the connection to see if they are authorized to
do the requested function. Anyone got any ideas?

Thanks in advance.

Jim Hawley
 

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

Top