473,670 Members | 2,724 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

location.replac e

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

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

For example:

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

Button1.Attribu tes.Add("onclic k", "window.ale rt
('Hello');") ' this works
Button1.Attribu tes.Add("onclic k", "location.repla ce
('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 1813
I think that

Server.Transfer
or
Response.Redire ct

is what you are looking for.
"brian" <an*******@disc ussions.microso ft.com> wrote in message
news:0b******** *************** *****@phx.gbl.. .
Is there a way to use location.replac e in code behind?

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

For example:

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

Button1.Attribu tes.Add("onclic k", "window.ale rt
('Hello');") ' this works
Button1.Attribu tes.Add("onclic k", "location.repla ce
('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.redire ct prevents the
user from returning to the originating page.
-----Original Message-----
I think that

Server.Transfe r
or
Response.Redir ect

is what you are looking for.
"brian" <an*******@disc ussions.microso ft.com> wrote in messagenews:0b******* *************** ******@phx.gbl. ..
Is there a way to use location.replac e in code behind?

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

For example:

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

Button1.Attribu tes.Add("onclic k", "window.ale rt
('Hello');") ' this works
Button1.Attribu tes.Add ("onclick", "location.repla ce ('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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
8565
by: Andoni | last post by:
Hi, I am only writing for IE 5.5+ so no need for compatibility at all ;-) I am trying to get my users to logoff which they finish on a particular page. This is no problem (or should be no problem) as I can just put a location.replace('http://www.mysite.com/html/logoff.jsp'); into the onUnload event of the page they always finish on. This should fire when they click the X in the corner (my app. is in a popup window) instead of hitting...
2
3614
by: James Marshall | last post by:
I'm trying to override location.replace() but I can't. I can override window.open(), document.write(), and other built-in methods, but not location.replace(). Here's a demo that overrides two built-in methods, then reports on them: location.replace= function (url) { alert(url) } ; alert('location.replace=\n'+location.replace) ; document.write= function (html) { alert(html) } ; alert('document.write=\n'+document.write) ;
5
7521
by: spam_me_ not | last post by:
I already understand that one cannot disable a browser's forward and back functions. This is a situation where I have code working in Mozilla V1.6 and would like something similar for Opera and IE. I link within a page and display individual divisions of that page, manipulating their visibility and display styles with an onClick function. As long as I explicitly click a link to progress, it works with browsers I've tried.
10
16570
by: Roland | last post by:
Hello, the example code is the following(the number in parentheses at the beginning are just for reference)(The complete HTML file is at the end of this article): (1)window.location = 'http://www.google.com'; (2)alert("I'm still here!"); (3)window.open("http://www.slashdot.com", "_blank");
1
2579
by: solutions | last post by:
Hi, Here is my relevant code for an arbitrary page (let's call it PAGE_B): <body onload="window.location.hash='anchor';"> With this code, if the user goes from PAGE_A to PAGE_B, he will jump to PAGE_B#anchor after PAGE_B has fully loaded. BUT... if he clicks the back button, instead of returning to PAGE_A (which is what I want), he will return to PAGE_B (without the anchor).
2
8558
by: JHB | last post by:
Hi, How can I do a location.replace when I use a form, like when I use a href? This works. <a href="Ny HTML-side20.htm"; method="post" id="frm" name="BrugerHovedSide" onsubmit="location.replace(this.href);" > <input class="ok" type="submit" value="Opfrisk data" id=submit1 name=submit1> </a>
3
3437
by: Al | last post by:
Hi all... I have created an aspx page that contains an animated GIF. I am using javascript and location.replace to redirect from this page to another aspx page which takes several seconds to load. When location.replace is called the animated GIFs in the first page stop animating. Is this standard behaviour? If so, is there an easy work around to prevent this?
9
6641
by: Jean Pierre Daviau | last post by:
Hi everybody, I have this function in a page (namely cours.html) function go(inValue) { var lien = 'file:///F:/MyWebs/jeanpierredaviaucom/httpdocs/cours1.html?T1=' + document.R.T1.value;
12
2218
by: Jack | last post by:
Since, I have not got some desired advise, I am reposting this for some asnwer/valuable suggestion. Thanks. THE FOLLOWING IS A PART OF CODE FROM A ASP PAGE <% sql01 = "SELECT COUNT(*) AS reccount FROM Equipmenttbl " sql01 = sql01 & "WHERE Equipmenttbl.GrantID = " & GrantID
5
5094
by: Alan Little | last post by:
Do a search at this site: http://www.mindsift.com/ Select a non-sponsored link, then give the site a rating. The rating frame closes. Now click your "back" button. If you're using IE, you'll go back to the search results. This is the desired behavior. In NS, FF and Opera, it takes you back to the frameset. I'm using top.location.replace; from my understanding that should do it. I *hate* it when only IE does what I want.
0
8386
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8661
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7421
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6216
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4213
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4393
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2802
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2044
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1795
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.