473,320 Members | 2,048 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.

Using @@SPID in IIS apps??

Is there a way to get unique @@SPID to database when programming solutions
for IIS in ASP.
When trying I realize that the actual client/user against MSSQL database is
IIS, not the currently logged on user.
So my question is, can I get a unique @@SPID for every "real" client using
my webapp. when creating connection against database?

reg.
Kjell Brandes
Aug 28 '07 #1
7 3296
Kjell Brandes wrote:
Is there a way to get unique @@SPID to database when programming
solutions for IIS in ASP.
When trying I realize that the actual client/user against MSSQL
database is IIS, not the currently logged on user.
So my question is, can I get a unique @@SPID for every "real" client
using my webapp. when creating connection against database?
If I understand you correctly, then you are using anonymous access, so
the answer is probably "no", unless you kill performance and scalability
by serializing all database access and disabling connection pooling
(definitely not recommended).

You may need to resort to using SessionID to identify users, or else
force them to login with unique login names.

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Aug 28 '07 #2
ok, thanks for the answer..

Another question.
I have tried to append sessionID to application Name "APP" in my
connectionstring. When trying to connect with 2 "real" clients. I get 2
different SPIDs. Is this because of that the name differs from each other?

Kjell

"Bob Barrows [MVP]" wrote:
Kjell Brandes wrote:
Is there a way to get unique @@SPID to database when programming
solutions for IIS in ASP.
When trying I realize that the actual client/user against MSSQL
database is IIS, not the currently logged on user.
So my question is, can I get a unique @@SPID for every "real" client
using my webapp. when creating connection against database?
If I understand you correctly, then you are using anonymous access, so
the answer is probably "no", unless you kill performance and scalability
by serializing all database access and disabling connection pooling
(definitely not recommended).

You may need to resort to using SessionID to identify users, or else
force them to login with unique login names.

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Aug 28 '07 #3
Yes. Any differences in connection string will prevent connection
pooling. This will have an adverse affect on performance and scalability
since you will prevent connections from being shared, except by those
processes using the same connection string. Whether this adverse affect
is unacceptable can only be answered by you.

Kjell Brandes wrote:
ok, thanks for the answer..

Another question.
I have tried to append sessionID to application Name "APP" in my
connectionstring. When trying to connect with 2 "real" clients. I get
2 different SPIDs. Is this because of that the name differs from each
other?

Kjell

"Bob Barrows [MVP]" wrote:
>Kjell Brandes wrote:
>>Is there a way to get unique @@SPID to database when programming
solutions for IIS in ASP.
When trying I realize that the actual client/user against MSSQL
database is IIS, not the currently logged on user.
So my question is, can I get a unique @@SPID for every "real" client
using my webapp. when creating connection against database?
If I understand you correctly, then you are using anonymous access,
so the answer is probably "no", unless you kill performance and
scalability by serializing all database access and disabling
connection pooling (definitely not recommended).

You may need to resort to using SessionID to identify users, or else
force them to login with unique login names.

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get
a quicker response by posting to the newsgroup.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Aug 28 '07 #4
Thanks for your time!!

Do you know if there is any "global variable" where you can ask for
ApplicationName?
like "SELECT @@SPID" for active connection.

Kjell

"Bob Barrows [MVP]" wrote:
Yes. Any differences in connection string will prevent connection
pooling. This will have an adverse affect on performance and scalability
since you will prevent connections from being shared, except by those
processes using the same connection string. Whether this adverse affect
is unacceptable can only be answered by you.

Kjell Brandes wrote:
ok, thanks for the answer..

Another question.
I have tried to append sessionID to application Name "APP" in my
connectionstring. When trying to connect with 2 "real" clients. I get
2 different SPIDs. Is this because of that the name differs from each
other?

Kjell

"Bob Barrows [MVP]" wrote:
Kjell Brandes wrote:
Is there a way to get unique @@SPID to database when programming
solutions for IIS in ASP.
When trying I realize that the actual client/user against MSSQL
database is IIS, not the currently logged on user.
So my question is, can I get a unique @@SPID for every "real" client
using my webapp. when creating connection against database?

If I understand you correctly, then you are using anonymous access,
so the answer is probably "no", unless you kill performance and
scalability by serializing all database access and disabling
connection pooling (definitely not recommended).

You may need to resort to using SessionID to identify users, or else
force them to login with unique login names.

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get
a quicker response by posting to the newsgroup.

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Aug 29 '07 #5
I've never heard of one.
Did you find one in Books Online? That's where I would look. Just to be
sure, you should ask on a sql server group, making sure you let them know
what version of sql server you are using.

Why are you trying to tie a spid to a user? To me, this is a dangerous thing
to be trying to do and can lead to problems for your application. And it
seems to display an ignorance of how http and asp work (don't get all huffy
and defensive - I can only go by what you've written in these posts - I'm
not trying to insult you, just advise you that you may have more to learn).

Maybe this will be of interest:
http://www.aspfaq.com/show.asp?id=2491

Kjell Brandes wrote:
Thanks for your time!!

Do you know if there is any "global variable" where you can ask for
ApplicationName?
like "SELECT @@SPID" for active connection.
>
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Aug 29 '07 #6
I can see why you asking...

The thing is that I maintains an application written in swedish with a lot
of businessrules for swedish laws. Such as calendar(worktime) and so on. This
application have to support other countries laws from now.
So I'm testing a method where I connects a usersession to a SPID in
database. Renaming all TABLES and making views with the same name as the
previous tablename. Adding a column to sourcetable telling the row for wich
county it applies to(CountryCode). By doing this I'm hoping that I wont need
to do that much coding in the application, adding countrycode to all WHERE in
SELECTs.

In the views I use SPID in combination with logged on user (usertable
contains countrycode) to resolve wich countrylaws I should apply on the
logged on user.

But to do this I have to get the value for the session saved on SQL-server.
Thats my actual problem, do you have any other ideas??

The database has 2 clienttypes, one win32 and one HTTPclient. The
win32client was no problem using SPIDs, but it seems to be a problem in
HTTPclient.

Kjell
PS. This is a bit of topic I know... Sorry!

"Bob Barrows [MVP]" wrote:
I've never heard of one.
Did you find one in Books Online? That's where I would look. Just to be
sure, you should ask on a sql server group, making sure you let them know
what version of sql server you are using.

Why are you trying to tie a spid to a user? To me, this is a dangerous thing
to be trying to do and can lead to problems for your application. And it
seems to display an ignorance of how http and asp work (don't get all huffy
and defensive - I can only go by what you've written in these posts - I'm
not trying to insult you, just advise you that you may have more to learn).

Maybe this will be of interest:
http://www.aspfaq.com/show.asp?id=2491

Kjell Brandes wrote:
Thanks for your time!!

Do you know if there is any "global variable" where you can ask for
ApplicationName?
like "SELECT @@SPID" for active connection.
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Aug 29 '07 #7
Or pass back the IP Address of the client and use that with every request to the database.

either that or create a GUID as soon as the web app starts and just keep passing that back with every request

Sep 5 '07 #8

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

Similar topics

0
by: Travis L. Alltop | last post by:
Is there an easy way to do this? I can see the SPID on SQL but its hostname is just the Metaframe Server, and that does not tell who it belongs to on that server when there is multiple users on...
2
by: Paul | last post by:
Is there a way to get the SPID at runtime (the server-side connection/process ID, which you can see in the management/current_activity/process_info area in Enterprise Manager) from an active...
1
by: Matik | last post by:
Hello 2 all, Maybe my question can be very stupid, but I'm a little confused. When I run sp_who on my database, I see one process (accessing remotely my database from another database on another...
1
by: Absinthe | last post by:
I am seeing intermittent blocking problems. The strange part of it is, that the SPID listed in the Blk By column is the same as the SPID that is being blocked. Has anyone seen this before, or...
1
by: Agnes | last post by:
when One user open the application, he will access around 5 database so there will be 5 spid in the sql server , right? if there are 200 hundres user , there will be 1000 right?
1
by: Yoda | last post by:
Hi, which is the syntax for a stored procedure that return to me the exact @@SPID of my current connection? I'm using ADO in VB6 and i want to obtain @@SPID Thank u Rob
2
by: suganya | last post by:
Hi I have to bind the DropDownList box with ID field hidden using SQLDataAdapter. For that I have given the coding as protected void Page_Load(object sender, EventArgs e) { ...
1
by: sweatha | last post by:
Hi I connected SQLDataSource in GridView by using coding <asp:GridView ID="Search_GridView" runat="server" Style="z-index: 100; left: 2px; position: absolute; top: 270px"...
2
by: Jaydeep Ramavat | last post by:
Dear friends, I have one google apps email account. I am sending a mail through the ASP.NET application. When i sent it from local network where internet access is available, it successfully...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
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: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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: 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: 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...

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.