Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 14th, 2004, 12:21 AM
Authorized User
 
Join Date: Sep 2004
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default deleting files as session expires

I need to delete a file when the session expires. I tried it in the global.asax file 'onsessionends' . It is not working. I used Request.Mappath() to get the application path. Else where should I write the code. Please help.....

 
Old October 14th, 2004, 12:36 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

You can use Server.MapPath to get the path or store the path in web.config. and delete the file from global.asax OnSessionEnd event

Regards
Ganesh
 
Old October 16th, 2004, 12:37 AM
Authorized User
 
Join Date: Sep 2004
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It is not working.

This is my code:

Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
        Dim dirName As String = Server.MapPath("STNXML\" + Session.SessionID)
        If Directory.Exists(dirName) Then
            Directory.Delete(dirName, True)
        End If
    End Sub

I think the session_end will not fire when I close my browser...
Thanks for the response......


 
Old October 16th, 2004, 05:39 AM
Authorized User
 
Join Date: Jul 2004
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to aravwind Send a message via Yahoo to aravwind
Default

whenever u close the browser window,
call Session.Abandon
then will end and ur code will work
i think so.
try ur luck
 
Old October 18th, 2004, 12:07 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

Session may not expire at the moment you close your browser. But certainly that event will fire.

Regards
Ganesh





Similar Threads
Thread Thread Starter Forum Replies Last Post
TIP: Redirecting when session expires jimibt BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 5 November 16th, 2007 05:42 AM
Session variable expires early BananaJim Classic ASP Professional 0 May 14th, 2007 05:58 AM
Session expires immediately codebuyer Classic ASP Components 6 March 18th, 2005 12:54 PM
Session expires imediately on logging in codebuyer Classic ASP Professional 3 February 24th, 2005 02:37 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.