Response.Redirect and Firefox

A

Andy

Hi all,

I'm having a problem with a response.redirect and firefox.

I have an error hanlder setup in the global.asax which issues a
response.redirect to a generic error page. This works fine in IE, but
in firefox I get an alert 'The document contains no data.' The error
occurs when the user attempts to submit a form with file uploads larger
than the server expects. I click the asp:button to submit, but the
browser doesn't like the redirection.

Any ideas?

Andy
 
J

Jani Järvinen [MVP]

Hi Andy,
I'm having a problem with a response.redirect and firefox.
This works fine in IE, but in firefox I get an alert 'The
document contains no data.'

I can't think of a reason right now why Firefox would behave differently in
this situation than IE. Are you sure you are not generating different code
for these two browsers, or that you are testing a similar situation?

Also, could you post relevant portitions of your ASP.NET source code? That
would help in solving the issue you're having.

--
Regards,

Mr. Jani Järvinen
C# MVP
Helsinki, Finland
(e-mail address removed)
http://www.saunalahti.fi/janij/
 
A

Andy

Jani,

I rechecked with IE on the same pages and it returns the Cannot find
server or DNS error page. So it doesn't work on either browser.

The C# code for the error handler in global.asax is:

Exception ex;
string qString;

ex = Server.GetLastError();

if ( ex is HttpUnhandledException && ex.InnerException != null ) {
ex = ex.InnerException;
}

LogManager.GetLogger( typeof( HttpApplication ) ).Error(
"There were errors processing a request", ex );

qString = "";
if ( ex.Message == "Maximum request length exceeded." ) {
qString = "?filesize=1";
}

Response.Redirect( "error.aspx" + qString, false );

It has something to do with file uploads; I have a maximum upload size
set and when i upload files (I allow more than one on a page) whose
total size exceed that limit, it triggers the error handler, but for
some reason the redirect isn't working. Nothing in the code behind for
the upload page itself is ever fired.

Thanks
Andy
 
J

Jani Järvinen [MVP]

Hi Andy!
I rechecked with IE on the same pages and it returns the Cannot find
server or DNS error page. So it doesn't work on either browser.

In that case, try stripping or commenting out code to make it simpler. It
could be that the code you have in the error handler is itself causing an
exception, or the code never gets executed. You have somekind of log manager
in place. Can you see an event in your log?

For example, try removing all other code from the event handler, and just
leave the Response.Redirect call in place. Does it work now? Also, you could
try to test the redirect in another location. Does it work now?

Hope these tips help you spot the fault.

--
Regards,

Mr. Jani Järvinen
C# MVP
Helsinki, Finland
(e-mail address removed)
http://www.saunalahti.fi/janij/
 

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

Top