By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,395 Members | 2,541 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,395 IT Pros & Developers. It's quick & easy.

SQL Server "CURRENT_USER" AND "user_name()"

P: n/a

We have SQL Server Stored Procedures that use the "CURRENT_USER" variable.
We have SQL Server database fields that call "user_name()" as a default.

That has been fine in the use and storage of user names, in the context of
being called from IIS 5 and 6, from ASP 3.0 using ADODB.
I'll add that the web applications are using Basic Authentication. So,
individual user account names are garnered and stored. That is valuable to

As far as I can tell, there is no way to obtain the same behavior with
ASP.NET, ADO, and SQL Server. The "CURRENT_USER" variable contains ( and
"user_name()" returns ) the "ASPNET" user if the database is hit from
ASP.NET being run in IIS 5. If ASP.NET is being run in IIS 6 in "worker
process isolation mode", instead of the "ASPNET" user you get the "NT
AUTHORITY / NETWORK SERVICE" user (unless you change that by use of the
"identity" field in the web.config file).

Here's a link to the web page that best summarizes the context of my

Using ASP.NET, IIS 6 and SQL Server, is there any way for the actual user's
logon to show up in SQL Server's "CURRENT_USER" variable and get returned
from SQL Server's "user_name()" function?

Nov 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.