Question on session_end()?

G

Guest

I have a question on session_end. I'm trying to log into my database when
the session times out, it will store user info into a table. When I got step
into a line where I was trying to open connection (I had it set to timeout in
1 minute, and ran it in debug mode), nothing happens. I read somewhere before
about how database call can't work with these settings in my web.config file.
I'm using <authentication mode="Windows" /> and <identity
impersonate="true"/>. Is this true? If true, is there any other way to call
my stored procedure (sql server) to log user information in session_end?
Thanks in advance.

Henry
 
G

Guest

Thank for the reply Curt. If I'm understanding you correctly, what you are
say is since due to timeout, I can even make any kind of database calls or it
it b/c all my sessions are empty? As far as I know, my sessions are there
once hit the session_end routine [verified the value in my
Session("logonUser")] but, hangs at the point where it's calling conn.open().
Here is a sample:

Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
_sql = "exec usp_ins_user_activity '" & Session("logonUser")
Dim _conString = "Data Source=dev01;Initial
Catalog=test;trusted_connection=yes"
conn = New SqlConnection(_conString)
conn.Open() ' <------*****hangs here
' etc .....
End Sub

Thanks again.

Henry
 
C

Curt_C [MVP]

You can still make a call, but not with info/items from the session. You can
get the user/pass from the Application probably, or better yet from a static
user/pass that you use for admin functions.

--
Curt Christianson
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com


Henry said:
Thank for the reply Curt. If I'm understanding you correctly, what you
are
say is since due to timeout, I can even make any kind of database calls or
it
it b/c all my sessions are empty? As far as I know, my sessions are there
once hit the session_end routine [verified the value in my
Session("logonUser")] but, hangs at the point where it's calling
conn.open().
Here is a sample:

Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
_sql = "exec usp_ins_user_activity '" & Session("logonUser")
Dim _conString = "Data Source=dev01;Initial
Catalog=test;trusted_connection=yes"
conn = New SqlConnection(_conString)
conn.Open() ' <------*****hangs here
' etc .....
End Sub

Thanks again.

Henry

Curt_C said:
You are trying to log information that is gone, due to the timeout.
 
G

Guest

Curt, what I did was I replace my session variable name in the routine with a
static string and it's still hangs. Sorry to drag this topic. Thanks..

Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
Dim abc as String = "henry"
_sql = "exec usp_ins_user_activity '" & abc
Dim _conString = "Data Source=dev01;Initial
Catalog=test;trusted_connection=yes"
conn = New SqlConnection(_conString)
conn.Open() ' <------*****hangs here
' etc .....
End Sub

p.s.
Also, I've found this link
http://dotnet247.com/247reference/msgs/41/209034.aspx which kind of talk
about my issue towards the middle, but not in detail. Does this make any
sense?

Curt_C said:
You can still make a call, but not with info/items from the session. You can
get the user/pass from the Application probably, or better yet from a static
user/pass that you use for admin functions.

--
Curt Christianson
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com


Henry said:
Thank for the reply Curt. If I'm understanding you correctly, what you
are
say is since due to timeout, I can even make any kind of database calls or
it
it b/c all my sessions are empty? As far as I know, my sessions are there
once hit the session_end routine [verified the value in my
Session("logonUser")] but, hangs at the point where it's calling
conn.open().
Here is a sample:

Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
_sql = "exec usp_ins_user_activity '" & Session("logonUser")
Dim _conString = "Data Source=dev01;Initial
Catalog=test;trusted_connection=yes"
conn = New SqlConnection(_conString)
conn.Open() ' <------*****hangs here
' etc .....
End Sub

Thanks again.

Henry

Curt_C said:
You are trying to log information that is gone, due to the timeout.

--
Curt Christianson
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com


I have a question on session_end. I'm trying to log into my database
when
the session times out, it will store user info into a table. When I
got
step
into a line where I was trying to open connection (I had it set to
timeout
in
1 minute, and ran it in debug mode), nothing happens. I read somewhere
before
about how database call can't work with these settings in my web.config
file.
I'm using <authentication mode="Windows" /> and <identity
impersonate="true"/>. Is this true? If true, is there any other way
to
call
my stored procedure (sql server) to log user information in
session_end?
Thanks in advance.

Henry
 
C

Curt_C [MVP]

where are you detecting this "hang"?
Have you tested this connString outside of the Session_End?

--
Curt Christianson
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com


Henry said:
Curt, what I did was I replace my session variable name in the routine
with a
static string and it's still hangs. Sorry to drag this topic. Thanks..

Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
Dim abc as String = "henry"
_sql = "exec usp_ins_user_activity '" & abc
Dim _conString = "Data Source=dev01;Initial
Catalog=test;trusted_connection=yes"
conn = New SqlConnection(_conString)
conn.Open() ' <------*****hangs here
' etc .....
End Sub

p.s.
Also, I've found this link
http://dotnet247.com/247reference/msgs/41/209034.aspx which kind of talk
about my issue towards the middle, but not in detail. Does this make any
sense?

Curt_C said:
You can still make a call, but not with info/items from the session. You
can
get the user/pass from the Application probably, or better yet from a
static
user/pass that you use for admin functions.

--
Curt Christianson
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com


Henry said:
Thank for the reply Curt. If I'm understanding you correctly, what you
are
say is since due to timeout, I can even make any kind of database calls
or
it
it b/c all my sessions are empty? As far as I know, my sessions are
there
once hit the session_end routine [verified the value in my
Session("logonUser")] but, hangs at the point where it's calling
conn.open().
Here is a sample:

Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
_sql = "exec usp_ins_user_activity '" & Session("logonUser")
Dim _conString = "Data Source=dev01;Initial
Catalog=test;trusted_connection=yes"
conn = New SqlConnection(_conString)
conn.Open() ' <------*****hangs here
' etc .....
End Sub

Thanks again.

Henry

:

You are trying to log information that is gone, due to the timeout.

--
Curt Christianson
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com


I have a question on session_end. I'm trying to log into my database
when
the session times out, it will store user info into a table. When I
got
step
into a line where I was trying to open connection (I had it set to
timeout
in
1 minute, and ran it in debug mode), nothing happens. I read
somewhere
before
about how database call can't work with these settings in my
web.config
file.
I'm using <authentication mode="Windows" /> and <identity
impersonate="true"/>. Is this true? If true, is there any other
way
to
call
my stored procedure (sql server) to log user information in
session_end?
Thanks in advance.

Henry
 
G

Guest

I've got the same db call in my index.aspx and it works fine inserting a row
in my table. It's just when I have it in session_end, it doesn't insert a
row. I've used my vs2003 debugger to set a break point in this session_end
routine. After waiting a minute, my code stops at this break point and when
I step through it and once it's at conn.open(), it does what is equivalent to
F5 (continue) and act as it's finished the session_end routine. I thought it
was hanging but it's not. However, rest of my code of executing my command
does not work since, I don't have the row inserted in my table. It is kind
of strange behavior.



Curt_C said:
where are you detecting this "hang"?
Have you tested this connString outside of the Session_End?

--
Curt Christianson
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com


Henry said:
Curt, what I did was I replace my session variable name in the routine
with a
static string and it's still hangs. Sorry to drag this topic. Thanks..

Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
Dim abc as String = "henry"
_sql = "exec usp_ins_user_activity '" & abc
Dim _conString = "Data Source=dev01;Initial
Catalog=test;trusted_connection=yes"
conn = New SqlConnection(_conString)
conn.Open() ' <------*****hangs here
' etc .....
End Sub

p.s.
Also, I've found this link
http://dotnet247.com/247reference/msgs/41/209034.aspx which kind of talk
about my issue towards the middle, but not in detail. Does this make any
sense?

Curt_C said:
You can still make a call, but not with info/items from the session. You
can
get the user/pass from the Application probably, or better yet from a
static
user/pass that you use for admin functions.

--
Curt Christianson
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com


Thank for the reply Curt. If I'm understanding you correctly, what you
are
say is since due to timeout, I can even make any kind of database calls
or
it
it b/c all my sessions are empty? As far as I know, my sessions are
there
once hit the session_end routine [verified the value in my
Session("logonUser")] but, hangs at the point where it's calling
conn.open().
Here is a sample:

Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
_sql = "exec usp_ins_user_activity '" & Session("logonUser")
Dim _conString = "Data Source=dev01;Initial
Catalog=test;trusted_connection=yes"
conn = New SqlConnection(_conString)
conn.Open() ' <------*****hangs here
' etc .....
End Sub

Thanks again.

Henry

:

You are trying to log information that is gone, due to the timeout.

--
Curt Christianson
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com


I have a question on session_end. I'm trying to log into my database
when
the session times out, it will store user info into a table. When I
got
step
into a line where I was trying to open connection (I had it set to
timeout
in
1 minute, and ran it in debug mode), nothing happens. I read
somewhere
before
about how database call can't work with these settings in my
web.config
file.
I'm using <authentication mode="Windows" /> and <identity
impersonate="true"/>. Is this true? If true, is there any other
way
to
call
my stored procedure (sql server) to log user information in
session_end?
Thanks in advance.

Henry
 
B

bruce barker

when session_end fired, its not tied to a request, so the thread runs as the
asp.net account. the default setup is that asp.net does not have access to
sql (unless you used standard security).

you have a several of options.

1) use standard or mixed security, and use standard security in the connect
string in this routine
2) impersonate a domain account with permission to the sqlsever before
making the call
3) run all sql thru a fixed domain account, <authentication mode="Windows"
userName="domain\account" password="myPassword />
4) change the asp.net account to a domain account
5) if ii6, use a pool account
7) leave asp.net as local, but give it a known password, and create a
matching local account on the sqlserver

-- bruce (sqlwork.com)



| I have a question on session_end. I'm trying to log into my database when
| the session times out, it will store user info into a table. When I got
step
| into a line where I was trying to open connection (I had it set to timeout
in
| 1 minute, and ran it in debug mode), nothing happens. I read somewhere
before
| about how database call can't work with these settings in my web.config
file.
| I'm using <authentication mode="Windows" /> and <identity
| impersonate="true"/>. Is this true? If true, is there any other way to
call
| my stored procedure (sql server) to log user information in session_end?
| Thanks in advance.
|
| Henry
|
 

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

Similar Threads


Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,120
Latest member
ShelaWalli
Top