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).
--=20
Sorin Dolha [MCAD, MCSD .NET]
[quoted text, click to view] "Anatoly" <anatoly@hotmail.com> wrote in message =
news:e7YBqoGAEHA.688@tk2msftngp13.phx.gbl...
For your information:
If you do redirect inside try block exception thrown and catch block =
executes.
[quoted text, click to view] "Sorin Dolha [MCSD .NET]" <sdolha@hotmail.com> wrote in message =
news:OplLw%23CAEHA.552@TK2MSFTNGP11.phx.gbl...
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,
--=20
Sorin Dolha [MCAD, MCSD .NET]
[quoted text, click to view] "Nileshw" <anonymous@discussions.microsoft.com> wrote in message =
news:8492F86A-C3E6-4C77-8398-EFAE7EC2F925@microsoft.com...
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")
=20
catch ex as exception
throw ex=20
=20
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=20
catch part but application get crash on =
response.redirect line.
How to solve this problem
Thanks and regards