Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Reading session object in global.aspx

Thread Tools

Reading session object in global.aspx

Posts: n/a
I have an application that allows users to select one or more files to
upload to the server. Each of the html file controls is stored in an
array that is held in the session object. This allows the user to
select all the files they need to upload at once before clicking the
upload button. However, the users want a warning to appear if there
are files selected and the user tries to navigate away from the page
without actually clicking the upload button.

(sorry for the long post...almost done)

My solution was to check the session object in the
application_beginrequest event. If the user was attempting to do
something else and the session object had files in it, then redirect
back to the page with a request param that would initiate action to
confirm the user's request. Like this...

Sub Application_BeginRequest(ByVal sender As Object, ByVal e As
On Error Resume Next
Dim cntx As HttpContext = HttpContext.Current
If UCase(Request.Params.Item("func")) <> "LOANDOCS" And
cntx.Session.Item("filearray") <> Nothing Then
If Err.Number = 0 Then

Response.Redirect("partnerhome.aspx?func=loandocs& pending=1")
End If
End If
On Error GoTo 0
End Sub

My question is quite simply is this acceptable? I'm comfortable with
session management within the web forms, but admittedly don't know
enough about using the global.aspx to feel comfortable about what I'm
doing. If there is a better solution to the problem, I would
appreciate the feedback.


Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Session Timeout problems-web.confg session state and IIS session s =?Utf-8?B?Um9iSEs=?= ASP .Net 4 04-11-2007 04:52 PM
Stored Session object is mixed up with another user's session object. momo898 ASP .Net 2 10-12-2006 03:33 PM
Object creation - Do we really need to create a parent for a derieved object - can't the base object just point to an already created base object jon wayne C++ 9 09-22-2005 02:06 AM
Session State - What does it take to establish one single ASP.NET session per "browser session" Jeff Smythe ASP .Net 3 01-02-2004 04:10 AM
How can I "know" the difference between a session timed out and a session that did session.abort? Jazzis ASP General 2 09-23-2003 07:16 AM