location.replace

  • Thread starter Thread starter brian
  • Start date Start date
B

brian

Is there a way to use location.replace in code behind?

The code below will work for a window.alert but not for
location.replace.

For example:

Private Sub Page_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load

Button1.Attributes.Add("onclick", "window.alert
('Hello');") ' this works


Button1.Attributes.Add("onclick", "location.replace
('test2.aspx');") ' this doesn't

End Sub

I want to prevent the user from going back to test1.aspx
after executing server-side code. I know this will work
if I use a javascript function on the client side but then
it won't process my server-side code.
 
Neither server.transfer or response.redirect prevents the
user from returning to the originating page.
 
Back
Top