Customize Error Message caused by uploading big file? (No DNS error)

H

henry

Hi all,

When user upload a file, there is a size limit (default is 4M). And we
can change this size limit by changging the config file.
If a user upload a file bigger than this size, an DNS error will be
displayed.
Now my question is whether we can customize this error message?
Displaying a DNS error page is quite misleading to normal user.
I would rather display a page saying "The file you upload should not
exceed 4M" and then put a link there for the user to go back to
previous page.
Is this possible?

Thank you.

Henry
 
G

Guest

Yes, it is possible

put the upload inside of a try/catch block

tr

// uploa

catch(Exception ex) // or the more specific DNS Exception you receiv

// if it is a DNS Exceptio
lblErrors.Text = "The file could not be uploaded. Files over 4mb are not allowed. Please check the file size and try again.
}
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top