473,465 Members | 1,897 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Automatic redirection

How can I incorporate the following javascript code in an ASP.NET
application (using VB.NET)
Like the following

If textbox1.text = "" then

<SCRIPT LANGUAGE="JavaScript" runat="server">
setTimeout("go_now()",5000);
function go_now () { window.location.href =
"http://testweb.cs.ul.ie/PGrad/JoanneC/Input_Methods.aspx"; }
</SCRIPT>

end If

Since when I used the response.redirect method, it does not allow
delay before it redirect to the page.

Thanks
Joanne
Nov 17 '05 #1
1 2543
Well, you could use a Thread.Sleep on the server side to wait for 5 seconds
then goto the next page...may not be what was intended.

Otherwise, you could use Page.RegisterClientScriptBlock to put your script
in the page (but put it in a function call) and redirect via JScript when
your click event or redirection event is initiated by the user.

Or, after postback have the page redisplay itself but use
Page.RegisterStartupScript in the server code instead, which causes this
script to be written as-is, so 5 seconds after being written, the redirect
would happen.

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
"JoanneC" <Jo***********@ul.ie> wrote in message
news:c3************************@posting.google.com ...
How can I incorporate the following javascript code in an ASP.NET
application (using VB.NET)
Like the following

If textbox1.text = "" then

<SCRIPT LANGUAGE="JavaScript" runat="server">
setTimeout("go_now()",5000);
function go_now () { window.location.href =
"http://testweb.cs.ul.ie/PGrad/JoanneC/Input_Methods.aspx"; }
</SCRIPT>

end If

Since when I used the response.redirect method, it does not allow
delay before it redirect to the page.

Thanks
Joanne

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Andrew | last post by:
I am setting up a web page to collect some data via a questionnaire. The questionnaire part is working fine, but I need some help with one part. I have two different versions of the questionnaire...
52
by: Gerard M Foley | last post by:
Can one write a webpage which is not displayed but which simply redirects the user to another page without any action by the user? Sorry if this is simple, but I am sometimes simple myself. ...
2
by: Fabiano | last post by:
Please, I need refresh automatically my asp.net page into an interval of 30 seconds. But i need that this refresh fires a postback event so i could manage it. Any idea? tks in adv. ...
3
by: Victor | last post by:
Dear Members I'm new here. Please permit me to ask some newbie question I'm from a non-profit organization, working for gender equality. We wish to get a small message across to sister blogs...
8
by: Luciano A. Ferrer | last post by:
Hi! I was following the http://www.seomoz.org/articles/301-redirects.php article, trying to do that with one of my test sites I added this to the .htaccess file: RewriteEngine On RewriteCond...
13
by: souissipro | last post by:
Hi, I have written a C program that does some of the functionalities mentionned in my previous topic posted some days ago. This shell should: 1- execute input commands from standard input,...
1
by: Siva | last post by:
Hi, Can somebody help me in getting me a code for automatic redirection. I have a message box in my project. If somebody post a message, after clicking the submit button a thankyou.aspx page...
2
by: Gregor Horvath | last post by:
Hi, As I am no expert web programmer I thought I'd better ask the experts if there is a simpler or better solution to my problem than the one I am thinking of. (using TurboGears) The problem...
1
by: comp.lang.php | last post by:
require_once("/users/ppowell/web/php_global_vars.php"); if ($_GET) { // INITIALIZE VARS $fileID = @fopen("$userPath/xml/redirect.xml", 'r'); $stuff = @fread($fileID,...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
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 ...

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.