file upload asp.net

G

Guest

Thanks John. The code does go into the application error
event during debugging, but does not redirect the page to
the error page. i tried ALL three methods i.e.
response.redirect, server.transfer and server.execute. But
the error page is not displyed. My error page has just one
label on it which says " Error occured in file transfer" .
It still shows the DNS error page.
Please shed some light on this if u can. Thank you.
-----Original Message-----
Try to catch the exception in the Application_Error event handler in
the global.asax file

Code:
=====

Dim AppEx As Exception = Server.GetLastError()
If AppEx.Message.CompareTo("Maximum request length exceeded.") = 0 Then
'this is an overlimit upload
'clear the error out
Server.ClearError()
'redirect to my error page
Response.Redirect("errorpage.aspx")
End If

Please let me know if this works for you.

Thank you,
John Soulis
Microsoft, ASP.NET

This posting is provided "AS IS", with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

.
..
 

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,995
Messages
2,570,236
Members
46,824
Latest member
Nater888

Latest Threads

Top