Reading session object in global.aspx

G

Greg

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
EventArgs)
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.

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top