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

Caller identity

lac
I am using SQL Server 2000 and SQL authentication in a web
appliacation. All data access is done via single SQL Server account.
In my front end I am using forms authentication. Is there a way to
retrieve the forms identity (or just a username) from SQL Server?

Thanks,
Lac

Jul 23 '05 #1
2 1768
Stu
SQL can only know what's passed through the connection string, which
will be the SQL username.

Of course, there might be a solution if you describe more of the
problem; are you trying to log user activity? Do you just need to know
when a certain user is logged on or off?

Stu

Jul 23 '05 #2
[posted and mailed, please reply in news]

(la*@myrealbox.com) writes:
I am using SQL Server 2000 and SQL authentication in a web
appliacation. All data access is done via single SQL Server account.
In my front end I am using forms authentication. Is there a way to
retrieve the forms identity (or just a username) from SQL Server?


Yes, but the form has to cooperate, and do this:

DECLARE @bin varbinary(128)
SELECT @bin = convert(varbinary(128), 'Username')
SET CONTEXT_INFO @bin

Then you can retrieve the username in SQL Server this way:

DECLARE @username varchar(128)
SELECT @username = convert(varchar(128), context_info)
FROM master.dbo.sysprocesses
WHERE spid = @@spid

Note that on SQL 2005, you should replace the access to sysprocesses to
use the built-in function context_info(). (Which unfortunately is not
available in SQL 2000.)

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 23 '05 #3

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

Similar topics

7
by: ivan_oj28 | last post by:
Hi, I am developing an application where I need to read the caller id from an incoming call. The only info (for now) I need is the caller id info, so that I can display the propper caller info on...
1
by: Matthew Houseman | last post by:
All, What's the accepted best practice for persisting data? Commit by the PL/SQL or commit by the caller (C#, Java, VB, etc.). I believe that if the caller starts a transaction and calls...
9
by: jaden10001 | last post by:
I have read that the function.caller method is now depricated. I see alot of browsers still support it but Opera 7 does not. Is there a way to get the name of the caller of a function in Opera 7?
4
by: Thomas Mlynarczyk | last post by:
Hi, I stumbled over a strange behaviour of Mozilla. When I want to access the caller property of a function that was not called from within another function, Mozilla seems to abort the script....
9
by: Csaba Gabor | last post by:
Inside a function, I'd like to know the call stack. By this I mean that I'd like to know the function that called this one, that one's caller and so on. So I thought to do: <script...
2
by: Mike9900 | last post by:
Hello, We need to know the module that called the other module in that module. For example, StartMyTransaction module,is called by module 'A' and after that module 'B' calls EndMyTransaction,...
5
by: pamelafluente | last post by:
Hi guys, How do I get the full name of the current (overload) function or sub (whatever it be) ? Sub SomeFunction() Dim FullNameOfThisFunction = ??? msgbox(FullNameOfThisFunction )
7
by: Rahul | last post by:
Hi Everyone, I have a function utility() which is a part of a library and i would like to know as to who is invoking the function. I could request that information as a parameter enumeration,...
7
by: =?UTF-8?B?QW50w7NuaW8gTWFycXVlcw==?= | last post by:
Hi, Sorry if this's been discussed before, I couldn't find it. As well you know, the ECMAScript standard doesn't include any way to access a function's caller. This has been available on Mozilla...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.