mountainbiking
02-03-2007, 07:06 AM
If I have a DetailsView inside of a FormView (to display relational records) and I want to display a warning to the user that if they don't have the proper session variable value they will be given an error. What I have now is this:
If Session("user") = "" And e.NewMode = DetailsViewMode.Edit Then
Try
Response.Redirect("default.aspx")
Catch ex As Exception
ex.Message.ToString()
End Try
End If
End Sub
This works fine... but I don't really want to be directed to another page. I want to have the error displayed then have the user click a link that send them back to their previous state. Response.Write does not work because it will write my Custom Error then display the rest of the page.
This is how I handled errors in Classic ASP and it worked great. I know there is a new and better method to doing so in ASP.Net I just have not figured it out yet.
P.S. And if I do need to post to a new page (lets just say it would be an errors.aspx page) how could I determine where the error is coming from in order to display the correct message on that page?
Thanks!!!!!
If Session("user") = "" And e.NewMode = DetailsViewMode.Edit Then
Try
Response.Redirect("default.aspx")
Catch ex As Exception
ex.Message.ToString()
End Try
End If
End Sub
This works fine... but I don't really want to be directed to another page. I want to have the error displayed then have the user click a link that send them back to their previous state. Response.Write does not work because it will write my Custom Error then display the rest of the page.
This is how I handled errors in Classic ASP and it worked great. I know there is a new and better method to doing so in ASP.Net I just have not figured it out yet.
P.S. And if I do need to post to a new page (lets just say it would be an errors.aspx page) how could I determine where the error is coming from in order to display the correct message on that page?
Thanks!!!!!