473,387 Members | 3,801 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

server-side timer vs. meta refresh

After much effort, it doesn't seem possible to redirect the user to a new
page after 10 seconds by using a server-side timer. I am now using the
following meta statement to accomplish the same thing:

<META HTTP-EQUIV="refresh" content="10;URL=Form_Welcome.aspx">

This seems to work fine, but I now have three concerns because I thought it
was supposed to be possible to do everything in C#.
1. Note that Visual Studio lets the developer drag and drop a timer onto the
web form, which now seems like a pointless feature.
2. Will server-side code know how to handle the redirection caused by the
META tag as well as if I had used C#?
3. I manually edited the .aspx file, which means that my code is not as
clean and is harder to maintain.

Jim
Nov 17 '05 #1
4 6204
Well it is possible, but this can be easier and cleanly accomplished on the
client side since you are implying that after some event of time period on
the client, it should redirect itself somewhere else. This is not really a
server side concern, but rather a client side issue, hence the solution
should probably be a client side solution.

It isn't pointless. It just doesn't work cleanly in your situation. Here's
one scenario where it comes in. If you want clean up on the server after a
scheduled amount of time, a timer is a very good avenue. Notice, this would
be a server side solution not requiring client-side interference.

The redirection is handled just as if it were server transfer or redirect.

:-( that's the disadvantage of using the inline code method.

--
-----------
Got TidBits?
Get it here: www.networkip.net/tidbits
"Jim Hammond" <jh******@postalinnovations.com> wrote in message
news:OQ**************@TK2MSFTNGP10.phx.gbl...
After much effort, it doesn't seem possible to redirect the user to a new
page after 10 seconds by using a server-side timer. I am now using the
following meta statement to accomplish the same thing:

<META HTTP-EQUIV="refresh" content="10;URL=Form_Welcome.aspx">

This seems to work fine, but I now have three concerns because I thought it was supposed to be possible to do everything in C#.
1. Note that Visual Studio lets the developer drag and drop a timer onto the web form, which now seems like a pointless feature.
2. Will server-side code know how to handle the redirection caused by the
META tag as well as if I had used C#?
3. I manually edited the .aspx file, which means that my code is not as
clean and is harder to maintain.

Jim

Nov 17 '05 #2
Jim Hammond wrote:
After much effort, it doesn't seem possible to redirect the user to a new
page after 10 seconds by using a server-side timer. I am now using the
following meta statement to accomplish the same thing:

<META HTTP-EQUIV="refresh" content="10;URL=Form_Welcome.aspx">

This seems to work fine, but I now have three concerns because I thought it
was supposed to be possible to do everything in C#.
1. Note that Visual Studio lets the developer drag and drop a timer onto the
web form, which now seems like a pointless feature.
There are uses for timers on the server-side. It doesn't happen to fit
our application well, however.
2. Will server-side code know how to handle the redirection caused by the
META tag as well as if I had used C#?
I'm not sure what you're asking... The server doesn't really know
anything about the redirection. The browser simply makes a request to
the URL specified in meta tag. If the URL is pointing back to the same
server, then the server will be aware of it. If the URL points
somewhere else, then the server will never know.
3. I manually edited the .aspx file, which means that my code is not as
clean and is harder to maintain.
You can handle the meta tag using C# code-behind techniques by giving
the meta tag an id attribute and a runat="server" attribute. Then in
the code-behind, declare an HtmlGenericControl in your Page class with
the same name as the meta tag's id attribute.

Now you can add the HTTP-EQUIV and content attributes using C# code.
This will let you dynamically control how long the refresh time is, and
where the redirection will go. You could also remove the meta tag
altogether (if you don't want the redirection) by setting the Visible
property to false.

Finally you can use C# to inject Javascript into the page (using
RegisterClientScriptBlock() and/or RegisterStartupScript()) which would
perform the refresh, if you'd rather not use the meta tag - this would
give you additional possibilities for handling the redirection.

Jim


Controlling the client in a disconnected web browser model is
significantly different from controlling the client in a Windows
application or dedicated, connected client application model.

--
mikeb

Nov 17 '05 #3
In article <uX**************@TK2MSFTNGP10.phx.gbl>, mikeb wrote:
Jim Hammond wrote:

3. I manually edited the .aspx file, which means that my code is not as
clean and is harder to maintain.


You can handle the meta tag using C# code-behind techniques by giving
the meta tag an id attribute and a runat="server" attribute. Then in
the code-behind, declare an HtmlGenericControl in your Page class with
the same name as the meta tag's id attribute.


Or in this case, since it's an HTTP-EQUIV, you can just add the header
directly and forget about the meta tags altogether.

Response.AppendHeader("Refresh", "3; URL=/some/url/here")
Although, in the general case, I don't really see manually editing the
..aspx file as A Bad Thing.

--
David
dfoster at
hotpop dot com
Nov 17 '05 #4
David wrote:
In article <uX**************@TK2MSFTNGP10.phx.gbl>, mikeb wrote:
Jim Hammond wrote:
3. I manually edited the .aspx file, which means that my code is not as
clean and is harder to maintain.


You can handle the meta tag using C# code-behind techniques by giving
the meta tag an id attribute and a runat="server" attribute. Then in
the code-behind, declare an HtmlGenericControl in your Page class with
the same name as the meta tag's id attribute.

Or in this case, since it's an HTTP-EQUIV, you can just add the header
directly and forget about the meta tags altogether.

Response.AppendHeader("Refresh", "3; URL=/some/url/here")
Although, in the general case, I don't really see manually editing the
.aspx file as A Bad Thing.


Good call.

I'd agree that editing the aspx file is not necessarily a bad thing - in
fact, it would be my preference if the refresh should be there
unconditionally.

The Response.AddHeader() approach would be the best for dynamically
adding the redirection.

--
mikeb

Nov 17 '05 #5

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

Similar topics

2
by: Phil | last post by:
I am using a Pascal like language (Wealth-Lab) on W2K and call this server: class HelloWorld: _reg_clsid_ = "{4E797C6A-5969-402F-8101-9C95453CF8F6}" _reg_desc_ = "Python Test COM Server"...
6
by: Nathan Sokalski | last post by:
I want to set up SQL Server on Windows XP Pro so that I can use the database capabilities of ASP and IIS. I am probably using some incorrect settings, but I am not sure what they are. Here is what...
9
by: Grim Reaper | last post by:
My work let me put SQL Server 7.0 Enterprise Edition on my laptop. I have never setup a server from the beginning, so I am a little new at creating server groups. Alright, I am trying to create...
0
by: Chris Halcrow | last post by:
Hi I've spent ALL DAY trying to re-install SQL Server 2000 on Windows XP. I continually get the error 'cannot configure server' just at the end of the installation. I've tried the following: ...
0
by: Zorba.GR | last post by:
IBM DB2 Connect Enterprise Edition v8.2, other IBM DB2 (32 bit, 64 bit) (MULTiOS, Windows, Linux, Solaris), IBM iSoft Commerce Suite Server Enterprise v3.2.01, IBM Tivoli Storage Resource Manager...
22
by: EP | last post by:
When running my asp.net hosting service (asp.net without IIS), on server 2003 with IIS not installed, I get the following when trying to process a request. "System.DllNotFoundException: Unable to...
4
by: coosa | last post by:
Hi, I was installing SQL Server on my machine and during installation my PC freezed. It happens frequently on my machine. So i tried after restarting to install it again and since then i always...
1
by: Peter | last post by:
I've purchased VS.NET 2005 Standard and have tried to install SQL Server 2005 Express, but get the following error in the error log. Please could someone help me.... Microsoft SQL Server 2005...
14
by: Marcus | last post by:
I have a function that simply returns TRUE if it can connect to a particular Sql Server 2005 express, or FALSE if it cannot. I am getting some strange error codes returned when the computer that...
14
by: Developer | last post by:
Hello All, i have recently installed VS2005 and was trying to install SQL sever 2000. I have Win XP' SP2. But when I tried installing, it only installed client tools and not the database. Can...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...

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.