File upload limit handleing

Discussion in 'ASP .Net' started by MS News \(MS ILM\), Aug 18, 2004.

  1. Hello,

    How do I handle a user uploading a file from the browser that exceeds the
    limit set by
    web or machine config files
    global.asax or handlers or module

    How can I return to the same upload page with some error to the user

    Thanks

    SAM
     
    MS News \(MS ILM\), Aug 18, 2004
    #1
    1. Advertising

  2. MS News \(MS ILM\)

    Karl Guest

    The only thing I know of is in the application's error event
    (Application_Error method in global.asax), you should be able to check
    Server.GetLastError().InnerException it should be of type HttpException
    with a message "Maximum request length exceeded"... you could check for
    that particular error, clear the error (server.ClearError()) and redirect
    back to the input page with a value in the querystring to indicate the
    error.

    Karl


    "MS News (MS ILM)" <> wrote in message
    news:%...
    > Hello,
    >
    > How do I handle a user uploading a file from the browser that exceeds the
    > limit set by
    > web or machine config files
    > global.asax or handlers or module
    >
    > How can I return to the same upload page with some error to the user
    >
    > Thanks
    >
    > SAM
    >
    >
     
    Karl, Aug 18, 2004
    #2
    1. Advertising

  3. MS News \(MS ILM\)

    Marina Guest

    I think at the pt of the application error event, there would be no page
    request to speak of, so I don't think you would be able to do this.

    "Karl" <none> wrote in message news:...
    > The only thing I know of is in the application's error event
    > (Application_Error method in global.asax), you should be able to check
    > Server.GetLastError().InnerException it should be of type HttpException
    > with a message "Maximum request length exceeded"... you could check for
    > that particular error, clear the error (server.ClearError()) and redirect
    > back to the input page with a value in the querystring to indicate the
    > error.
    >
    > Karl
    >
    >
    > "MS News (MS ILM)" <> wrote in message
    > news:%...
    > > Hello,
    > >
    > > How do I handle a user uploading a file from the browser that exceeds

    the
    > > limit set by
    > > web or machine config files
    > > global.asax or handlers or module
    > >
    > > How can I return to the same upload page with some error to the user
    > >
    > > Thanks
    > >
    > > SAM
    > >
    > >

    >
    >
     
    Marina, Aug 18, 2004
    #3
  4. MS News \(MS ILM\)

    Karl Guest

    I quickly tested it before suggesting it and it seemed to be working...

    Karl

    "Marina" <> wrote in message
    news:...
    > I think at the pt of the application error event, there would be no page
    > request to speak of, so I don't think you would be able to do this.
    >
    > "Karl" <none> wrote in message

    news:...
    > > The only thing I know of is in the application's error event
    > > (Application_Error method in global.asax), you should be able to check
    > > Server.GetLastError().InnerException it should be of type HttpException
    > > with a message "Maximum request length exceeded"... you could check for
    > > that particular error, clear the error (server.ClearError()) and

    redirect
    > > back to the input page with a value in the querystring to indicate the
    > > error.
    > >
    > > Karl
    > >
    > >
    > > "MS News (MS ILM)" <> wrote in message
    > > news:%...
    > > > Hello,
    > > >
    > > > How do I handle a user uploading a file from the browser that exceeds

    > the
    > > > limit set by
    > > > web or machine config files
    > > > global.asax or handlers or module
    > > >
    > > > How can I return to the same upload page with some error to the user
    > > >
    > > > Thanks
    > > >
    > > > SAM
    > > >
    > > >

    > >
    > >

    >
    >
     
    Karl, Aug 18, 2004
    #4
  5. Thank you all for your response.

    It seems that I can not redirect,
    It is not working for me
    There is no page to response
    I don't even get my custom error page.... which I don't really want any
    way, but just tired it.

    Thanks

    "Karl" <none> wrote in message news:...
    > I quickly tested it before suggesting it and it seemed to be working...
    >
    > Karl
    >
    > "Marina" <> wrote in message
    > news:...
    > > I think at the pt of the application error event, there would be no page
    > > request to speak of, so I don't think you would be able to do this.
    > >
    > > "Karl" <none> wrote in message

    > news:...
    > > > The only thing I know of is in the application's error event
    > > > (Application_Error method in global.asax), you should be able to check
    > > > Server.GetLastError().InnerException it should be of type

    HttpException
    > > > with a message "Maximum request length exceeded"... you could check

    for
    > > > that particular error, clear the error (server.ClearError()) and

    > redirect
    > > > back to the input page with a value in the querystring to indicate the
    > > > error.
    > > >
    > > > Karl
    > > >
    > > >
    > > > "MS News (MS ILM)" <> wrote in message
    > > > news:%...
    > > > > Hello,
    > > > >
    > > > > How do I handle a user uploading a file from the browser that

    exceeds
    > > the
    > > > > limit set by
    > > > > web or machine config files
    > > > > global.asax or handlers or module
    > > > >
    > > > > How can I return to the same upload page with some error to the user
    > > > >
    > > > > Thanks
    > > > >
    > > > > SAM
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
     
    MS News \(MS ILM\), Aug 20, 2004
    #5
    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. Vicky

    file upload size limit

    Vicky, Feb 11, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    524
    Eric Lawrence [MSFT]
    Feb 11, 2004
  2. David Lozzi
    Replies:
    4
    Views:
    589
    David Lozzi
    Jul 21, 2006
  3. Ola Natvig

    new style exception handleing

    Ola Natvig, Feb 2, 2005, in forum: Python
    Replies:
    4
    Views:
    306
    Nick Coghlan
    Feb 3, 2005
  4. Replies:
    1
    Views:
    1,090
    Victor Bazarov
    Jun 28, 2005
  5. lazyadmin

    ASP File Upload - Limit File Types?

    lazyadmin, Jan 7, 2005, in forum: ASP General
    Replies:
    1
    Views:
    353
    lazyadmin
    Jan 7, 2005
Loading...

Share This Page