Reading session object in global.aspx

Discussion in 'ASP .Net' started by Greg, Jun 20, 2006.

  1. Greg

    Greg Guest

    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.
     
    Greg, Jun 20, 2006
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. tony collier
    Replies:
    1
    Views:
    2,098
    Guest
    Jan 24, 2004
  2. Mike Malter
    Replies:
    3
    Views:
    4,896
    Marshal Antony
    Mar 29, 2004
  3. ss
    Replies:
    0
    Views:
    386
  4. John M
    Replies:
    1
    Views:
    1,212
    Kumar Reddi
    May 29, 2005
  5. momo898
    Replies:
    2
    Views:
    499
    bruce barker \(sqlwork.com\)
    Oct 12, 2006
Loading...

Share This Page