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

session question

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?

Thanks in advance
Nov 19 '05 #1
5 1920
Is you're storing SessionState out of process in the State Server or SqlServer,
Session_End is not called.

-Brock
DevelopMentor
http://staff.develop.com/ballen
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?

Thanks in advance


Nov 19 '05 #2
Session_End is called (by default) 20 minutes after the user's last page
request.
It has nothing to do with when then user closes their browser window(s).
Therefore your code probably works, just not as quickly as you'd thought it
would.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"anonmous" <an*******@discussions.microsoft.com> wrote in message
news:10****************************@phx.gbl...
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?

Thanks in advance

Nov 19 '05 #3
Thanks Steve,

now I am wondering if it makes sense to delete the file
in Session_End. Isnt there a way to detect if the browser
was closed? I would like to delete the file immediately
when the browser is closed.

Thanks

-----Original Message-----
Session_End is called (by default) 20 minutes after the user's last pagerequest.
It has nothing to do with when then user closes their browser window(s).Therefore your code probably works, just not as quickly as you'd thought itwould.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"anonmous" <an*******@discussions.microsoft.com> wrote in messagenews:10****************************@phx.gbl...
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?

Thanks in advance

.

Nov 19 '05 #4
Well, Session_End is certainly the easiest appraoch.

However, you may be able to take advantage of the client side OnClose event.
Here's more info:
http://www.mozilla.org/docs/dom/domr...dow_ref56.html

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Anonymous" <an*******@discussions.microsoft.com> wrote in message
news:08****************************@phx.gbl...
Thanks Steve,

now I am wondering if it makes sense to delete the file
in Session_End. Isnt there a way to detect if the browser
was closed? I would like to delete the file immediately
when the browser is closed.

Thanks

-----Original Message-----
Session_End is called (by default) 20 minutes after the

user's last page
request.
It has nothing to do with when then user closes their

browser window(s).
Therefore your code probably works, just not as quickly

as you'd thought it
would.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"anonmous" <an*******@discussions.microsoft.com> wrote in

message
news:10****************************@phx.gbl...
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?

Thanks in advance

.

Nov 19 '05 #5
Steve,

I have set the session timeout to 2 mins, however my
files dont get deleted. I tried the code in my webform and
it deleted the file. Here is my web.config session tag:

<sessionState mode="InProc"

stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data
source=127.0.0.1;Trusted_Connection=yes"
cookieless="false"
timeout="2"/>

Here is the code I used:

Sub Session_End(ByVal sender As Object, ByVal e As
EventArgs)
' Fires when the session ends

' Do we have any PDF created?
If Not Session("PDFReportFileName") Is Nothing Then
Dim arFileNames As ArrayList = Session
("PDFReportFileName")
Dim iFile As Integer = 0
For iFile = 0 To arFileNames.Count - 1
Dim strFileName As String = arFileNames
(iFile)
System.IO.File.Delete(Server.MapPath
(strFileName))
Next
End If
End Sub
Thanks for your help
-----Original Message-----
Well, Session_End is certainly the easiest appraoch.

However, you may be able to take advantage of the client side OnClose event.Here's more info:
http://www.mozilla.org/docs/dom/domr...indow_ref56.ht ml
--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Anonymous" <an*******@discussions.microsoft.com> wrote in messagenews:08****************************@phx.gbl...
Thanks Steve,

now I am wondering if it makes sense to delete the file in Session_End. Isnt there a way to detect if the browser was closed? I would like to delete the file immediately
when the browser is closed.

Thanks

-----Original Message-----
Session_End is called (by default) 20 minutes after the

user's last page
request.
It has nothing to do with when then user closes their

browser window(s).
Therefore your code probably works, just not as quickly

as you'd thought it
would.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"anonmous" <an*******@discussions.microsoft.com> wrote in
message
news:10****************************@phx.gbl.. .
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?

Thanks in advance
.

.

Nov 19 '05 #6

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

Similar topics

9
by: Xizor | last post by:
Let's say I run a server. I have two people using the server. Bill and Joe. Bill is at address.com/bill and Joe is at address.com/joe. Let's say Joe and Bill are both using PHP with sessions on...
1
by: Paul | last post by:
Hmmm, didn't seem to work. I have set session.use_cookies = 1 and session.use_trans_sid = 1 in my php.ini file. Index.php contains:...
3
by: VijayShankar | last post by:
Can u be more specific on your question Anyway its not like Session variables are available for sometime and not available for sometime. When your session starts it is very much available...
1
by: Ernest Forman | last post by:
How can I view the defined Session Variables in the Dotnet environment? I found the session object and it shows me the count of the number of items, but I don't see how to see the names and values...
3
by: Jeff Smythe | last post by:
I simply want to execute some code once when a new session of my ASP.NET application is started (I'm not using session state for anything else - just writing some data to a database). I thought...
4
by: DavidS | last post by:
First: There are several ways to confuse one regarding session timeout. (1) web.config - <sessionState timeout="20"> (2) IIS Manager | Internet Information Services | ServerNode | Default Web Site...
10
by: tshad | last post by:
I have been using the default session state (InProc) and have found that I have been loosing my information after a period of time (normally 20 minutes). Is there anyway to find out how much...
18
by: Rippo | last post by:
Hi I am using role base forms authentication in asp.net and have come across a problem that I would like advice on. On a successful login a session variable is set to identify a user. This is...
5
by: George | last post by:
Hi, Is it possible to delay session creation in ASP.NET I want the user to browse my site without any session created (no cookies set). My pages will know that is Session = null then Session has...
2
by: Kevin Frey | last post by:
Hello, I've been reading that ASP.NET serialises (ie. processes one at a time) HTTP requests if two simultaneous requests need to access the same session state. It also makes note that ASP.NET...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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

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.