Nobody said they don't. But if the redirect is to an incorrect URL no exception is thrown (no exception is generated by the Redirect statement, even if the URL is incorrect).
--
Sorin Dolha [MCAD, MCSD .NET]
For your information:
If you do redirect inside try block exception thrown and catch block executes.
Nileshw,
Redirecting to a web page that doesn't exist is not an exception, from the code point of view. The code managed to do the right job: it sent a request to the client browser to navigate to the page URL specified as the parameter for the Redirect() method. Therefore, no exception is thrown and no exception is to be caught on the server side code.
The problem will occur only later, when the client browser finds out that the requested URL is not found or that there was a problem when loading the new page from its web server (which may be another web server, from another part of the world). The client then displays a message describing the problem - but the server is now away from the situation.
If you redirect to a page existing in the same web application and want to generate an exception from the server side code, try to look for the required page (for example, using File.Exists(Server.MapPath("yourpage")) and if it doesn't exist, throw an exception yourself, from code (throw new Exception("yourpage was not found")), before redirecting.
I hope it helped,
--
Sorin Dolha [MCAD, MCSD .NET]
I am using try catch in my application. If I use response.redirect in try catch and suppose any error occur in response.redirect line , that error is not catched but crash my application.
For example
private sub subRedirectTo()
try
response.redirect("wrongfilename")
catch ex as exception
throw ex
end try
end sub
In above example suppose the URL name is wrong or file name is wrong then that exception is not handled in
catch part but application get crash on response.redirect line.
How to solve this problem
Thanks and regards
Nileshw