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

Question on session_end()?

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
7 1630
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Vincent | last post by:
hello there, I want to find out if I close a browser, does that end a session? I want to use a session variable to track the number of user of my site, so I add 1 to a session variable when the...
9
by: Kenn Ghannon | last post by:
I've got an ASP.NET page with a counter subtraction routine in the Session_End method in the Global.asax.cs: protected void Session_End(Object sender, EventArgs e) { ulong curUsers; ...
2
by: Bela | last post by:
Hello I was wondering if someone could help me out with a Session_End problem in my Global.asax. I've tried everything, and still no success Here is the scenario: sessionstate is set to InProc....
3
by: Guadala Harry | last post by:
Just wondering if Session_End *always fires* for every Session. I know that IIS times out sessions after a default 20 min (unless changed) and there's no way to know when a user actually closed a...
4
by: Kim Bach Petersen | last post by:
I would like to record user behavior data stored in session variables. Since the data is modified throughout each session it seemed obvious to store the data when the session terminates - using...
5
by: anonmous | last post by:
Hello, I am creating a pdf via some code. Now when the pdf is created, I assign the filename to a session variable and open a new window with the pdf. Now when the user closes the pdf window, I...
8
by: Roger | last post by:
When I call the session.abandon() method, it calls the session_end event. When a user closes the browser or clicks the log off button, I can dispose of objects and abandon the session cleaning....
1
by: =?Utf-8?B?YnJlbnQ5NjA=?= | last post by:
Environment: ASP.NET 2.0, SQL Server 2005, C#, Visual Studio 2005 In my Session_End event, I am executing a stored procedure to update a database table that is used to log user sessions. When...
12
by: =?Utf-8?B?QWxleCBNYWdoZW4=?= | last post by:
Hi. I am trying to maintain a list of people who are currently "online" in SQL. I do this by adding a simple entry to a simple PeopleOnline table whenever someone logs in to my site. If they...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.