Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_professional thread: Re: SmartNavigation and response.redirect


Message #1 by phartmann@a... on Thu, 25 Jul 2002 11:13:07
We redirect the page if there is an error while having smartnavigation on by
doing it in the code behind.  We wrap everything in a try and catch and use
server.transfer to redirect the page if there is an error. something like
this.  Now we also have an error flag in all our objects and throw the error
up from the objects so that we get a better error message.  Hope that helps.
Try
'Code
Catch ex as Exception
	 Catch ex As Exception
            'If the object errors in any way this should pick it up
            If myObj.ErrorFlag Then
                Server.Transfer("Error.aspx?ErrorMsg=" &
Server.UrlEncode(myObj.ErrorMessage) & "&From=" &
Request.ServerVariables("PATH_INFO"))
            Else
                'Call the custom error handler to get the error message.
                Server.Transfer("Error.aspx?ErrorMsg=" &
Server.UrlEncode(ex.ToString()) & "&From=" &
Request.ServerVariables("PATH_INFO"))
            End If
        End Try

 
 
David Debreceni
Senior VB/ASP Developer
david_debreceni@r... <mailto:david_debreceni@r...> 
xxx-xxx-xxxx  x1086


-----Original Message-----
From: phartmann@a... [mailto:phartmann@a...]
Sent: Thursday, July 25, 2002 7:13 AM
To: ASPX_Professional
Subject: [aspx_professional] Re: SmartNavigation and response.redirect


do you use the default web site or have you created
a new web site in your iis?

> I want to redirect to a custom error page. No problem when smart 
> navigation is =false on the page where the error occurs. But it doesn't 
> work when smartnavigation is true. I get a blank page with source
> <BODY><ASP_SMARTNAV_RDIR url="/ASPNET/CustomError.aspx?
> Err=Unspecified"></ASP_SMARTNAV_RDIR></BODY>
>  I want to keep smart navigation =true.
> Any ideas?


  Return to Index