473,770 Members | 5,977 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 <authenticati on mode="Windows" /> and <identity
impersonate="tr ue"/>. 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 1643
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***@discussi ons.microsoft.c om> wrote in message
news:AE******** *************** ***********@mic rosoft.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 <authenticati on mode="Windows" /> and <identity
impersonate="tr ue"/>. 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("logonU ser")] but, hangs at the point where it's calling conn.open().
Here is a sample:

Sub Session_End(ByV al sender As Object, ByVal e As EventArgs)
_sql = "exec usp_ins_user_ac tivity '" & Session("logonU ser")
Dim _conString = "Data Source=dev01;In itial
Catalog=test;tr usted_connectio n=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***@discussi ons.microsoft.c om> wrote in message
news:AE******** *************** ***********@mic rosoft.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 <authenticati on mode="Windows" /> and <identity
impersonate="tr ue"/>. 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***@discussi ons.microsoft.c om> wrote in message
news:D5******** *************** ***********@mic rosoft.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("logonU ser")] but, hangs at the point where it's calling
conn.open().
Here is a sample:

Sub Session_End(ByV al sender As Object, ByVal e As EventArgs)
_sql = "exec usp_ins_user_ac tivity '" & Session("logonU ser")
Dim _conString = "Data Source=dev01;In itial
Catalog=test;tr usted_connectio n=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***@discussi ons.microsoft.c om> wrote in message
news:AE******** *************** ***********@mic rosoft.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 <authenticati on mode="Windows" /> and <identity
> impersonate="tr ue"/>. 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(ByV al sender As Object, ByVal e As EventArgs)
Dim abc as String = "henry"
_sql = "exec usp_ins_user_ac tivity '" & abc
Dim _conString = "Data Source=dev01;In itial
Catalog=test;tr usted_connectio n=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***@discussi ons.microsoft.c om> wrote in message
news:D5******** *************** ***********@mic rosoft.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("logonU ser")] but, hangs at the point where it's calling
conn.open().
Here is a sample:

Sub Session_End(ByV al sender As Object, ByVal e As EventArgs)
_sql = "exec usp_ins_user_ac tivity '" & Session("logonU ser")
Dim _conString = "Data Source=dev01;In itial
Catalog=test;tr usted_connectio n=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***@discussi ons.microsoft.c om> wrote in message
news:AE******** *************** ***********@mic rosoft.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 <authenticati on mode="Windows" /> and <identity
> impersonate="tr ue"/>. 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***@discussi ons.microsoft.c om> wrote in message
news:2B******** *************** ***********@mic rosoft.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(ByV al sender As Object, ByVal e As EventArgs)
Dim abc as String = "henry"
_sql = "exec usp_ins_user_ac tivity '" & abc
Dim _conString = "Data Source=dev01;In itial
Catalog=test;tr usted_connectio n=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***@discussi ons.microsoft.c om> wrote in message
news:D5******** *************** ***********@mic rosoft.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("logonU ser")] but, hangs at the point where it's calling
> conn.open().
> Here is a sample:
>
> Sub Session_End(ByV al sender As Object, ByVal e As EventArgs)
> _sql = "exec usp_ins_user_ac tivity '" & Session("logonU ser")
> Dim _conString = "Data Source=dev01;In itial
> Catalog=test;tr usted_connectio n=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***@discussi ons.microsoft.c om> wrote in message
>> news:AE******** *************** ***********@mic rosoft.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 <authenticati on mode="Windows" /> and <identity
>> > impersonate="tr ue"/>. 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***@discussi ons.microsoft.c om> wrote in message
news:2B******** *************** ***********@mic rosoft.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(ByV al sender As Object, ByVal e As EventArgs)
Dim abc as String = "henry"
_sql = "exec usp_ins_user_ac tivity '" & abc
Dim _conString = "Data Source=dev01;In itial
Catalog=test;tr usted_connectio n=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***@discussi ons.microsoft.c om> wrote in message
news:D5******** *************** ***********@mic rosoft.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("logonU ser")] but, hangs at the point where it's calling
> conn.open().
> Here is a sample:
>
> Sub Session_End(ByV al sender As Object, ByVal e As EventArgs)
> _sql = "exec usp_ins_user_ac tivity '" & Session("logonU ser")
> Dim _conString = "Data Source=dev01;In itial
> Catalog=test;tr usted_connectio n=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***@discussi ons.microsoft.c om> wrote in message
>> news:AE******** *************** ***********@mic rosoft.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 <authenticati on mode="Windows" /> and <identity
>> > impersonate="tr ue"/>. 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, <authenticati on mode="Windows"
userName="domai n\account" password="myPas sword />
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***@discussi ons.microsoft.c om> wrote in message
news:AE******** *************** ***********@mic rosoft.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 <authenticati on mode="Windows" /> and <identity
| impersonate="tr ue"/>. 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
1192
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 "session_start", and minus 1 when "session_end". The session_start is fine, but the session_end never kick in. Thanks in advance.
9
10804
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; Application.Lock();
2
4733
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. I have timeout set to 1 min I have a variable in session_start that is incremented each new session, and it is then decremented in Session_End. I use this variable on a web form to show current users online. All of this works just fine, so I...
3
566
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 browser (unless I provide a "log out" button that kills the session explicitly, and we can't guarantee the user will click on that). What I am wondering if there are there well-known/documented circumstances under which Session_End will NOT fire...
4
9181
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 Session_End in global.asax. Problem is, apparently the session-object terminating cannot be accessed from Session_End in global.asax!? What's the meaning of Session_End if you don't know which session is
5
1958
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 would like to delete the file. I was thinking to check for the session variable in the global.asax.vb in the session_end. However when I close the pdf the session_end is never called. Is there any way to do that?
8
5770
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. But, when a user either navigates away from the web app and when the session timesout, the session_end event does not seem to fire. Or when else can I dispose of objects? Or is there an event I can you that is fired when a user navigates away from...
1
6940
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 the user sessions time out, the Session_End event fires successfully. The stored procedure executes successfully, and I can see the updated data in the database just as I would expect. Nonetheless, an exception is being generated by the code...
12
10700
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 manually log OUT of the site, I have no problem deleting them from the PeopleOnline table. But if they just close the browser, I was assuming I'd have to use the Session_End() event in Global.asax even though I know that this will only occur once the...
0
9425
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10231
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10059
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10005
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7416
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6679
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3972
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3576
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2817
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.