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

Question on session_end()?

P: n/a
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

Nov 19 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
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
"Henry" <He***@discussions.microsoft.com> wrote in message
news:AE**********************************@microsof t.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

Nov 19 '05 #2

P: n/a
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 [MVP]" wrote:
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
"Henry" <He***@discussions.microsoft.com> wrote in message
news:AE**********************************@microsof t.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


Nov 19 '05 #3

P: n/a
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" <He***@discussions.microsoft.com> wrote in message
news:D5**********************************@microsof t.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

"Curt_C [MVP]" wrote:
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
"Henry" <He***@discussions.microsoft.com> wrote in message
news:AE**********************************@microsof t.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
>


Nov 19 '05 #4

P: n/a
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 [MVP]" wrote:
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" <He***@discussions.microsoft.com> wrote in message
news:D5**********************************@microsof t.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

"Curt_C [MVP]" wrote:
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
"Henry" <He***@discussions.microsoft.com> wrote in message
news:AE**********************************@microsof t.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
>


Nov 19 '05 #5

P: n/a
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" <He***@discussions.microsoft.com> wrote in message
news:2B**********************************@microsof t.com...
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 [MVP]" wrote:
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" <He***@discussions.microsoft.com> wrote in message
news:D5**********************************@microsof t.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
>
> "Curt_C [MVP]" wrote:
>
>> 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
>>
>>
>> "Henry" <He***@discussions.microsoft.com> wrote in message
>> news:AE**********************************@microsof t.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
>> >
>>
>>
>>


Nov 19 '05 #6

P: n/a
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 [MVP]" wrote:
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" <He***@discussions.microsoft.com> wrote in message
news:2B**********************************@microsof t.com...
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 [MVP]" wrote:
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" <He***@discussions.microsoft.com> wrote in message
news:D5**********************************@microsof t.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
>
> "Curt_C [MVP]" wrote:
>
>> 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
>>
>>
>> "Henry" <He***@discussions.microsoft.com> wrote in message
>> news:AE**********************************@microsof t.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
>> >
>>
>>
>>


Nov 19 '05 #7

P: n/a
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)

"Henry" <He***@discussions.microsoft.com> wrote in message
news:AE**********************************@microsof t.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
|
Nov 19 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.