469,609 Members | 1,190 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,609 developers. It's quick & easy.

location.replace

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.
Jul 21 '05 #1
2 1652
I think that

Server.Transfer
or
Response.Redirect

is what you are looking for.
"brian" <an*******@discussions.microsoft.com> wrote in message
news:0b****************************@phx.gbl...
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.

Jul 21 '05 #2
Neither server.transfer or response.redirect prevents the
user from returning to the originating page.
-----Original Message-----
I think that

Server.Transfer
or
Response.Redirect

is what you are looking for.
"brian" <an*******@discussions.microsoft.com> wrote in messagenews:0b****************************@phx.gbl...
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.

.

Jul 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Andoni | last post: by
2 posts views Thread by James Marshall | last post: by
10 posts views Thread by Roland | last post: by
1 post views Thread by solutions | last post: by
2 posts views Thread by JHB | last post: by
9 posts views Thread by Jean Pierre Daviau | last post: by
5 posts views Thread by Alan Little | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.