Author |
Topic  |
|
benjamin64
New Member

84 Posts |
Posted - 18 July 2003 : 08:11:14
|
Is there any easy way of making a redirection.
I did think about maybe a include file where i can set a variable 1 0r 0 1 for redirect
and then on every page maybe make an if variable = 1 then redirect construction.asp else end if
And then put it into every page on my website.
and then when i need to update or change something, i can make that include file variable 1, and then all pages will redirect to a page messing please come back again later pages un.......
when people try to acces my pages, or is there a smartet way??
thanks
|
|
Roland
Advanced Member
    
Netherlands
9335 Posts |
Posted - 18 July 2003 : 16:46:46
|
I've done something similar, except I use cookies (if I close a site a cookie will have to be present to enter the pages, there's a second - hidden - page to set the cookie).
When using a variable, all you have to do is add the following in the include that you've added to all pages:
if variable = 1 then
Response.Redirect ("/construction.asp")
end if Then if you want to change the way that code works (for example the redirection page), you won't have to change all files but only the include. |
 |
|
benjamin64
New Member

84 Posts |
Posted - 24 July 2003 : 06:41:53
|
okay have some problems using it i get this error message.
Response object error 'ASP 0156 : 80004005'
Header Error /main/maintxt.asp, line 6
The HTTP headers are already written to the client browser. Any HTTP header modifications must be made before writing page content.
this is the main.asp <html> <!--#INCLUDE FILE="redirect.asp"--> <head> <% if redirect = 1 then Response.Redirect ("construction.asp") end if %> <base target="txt"> </head> <body> main page </body>
this is the redirect file
<html> <head> </head> <% dim redirect redirect = 1 %> </html>
this is the construction page
<html> <head> </head> <body> test </body> </html> |
 |
|
Doug G
Support Moderator
    
USA
6493 Posts |
Posted - 24 July 2003 : 12:02:41
|
Put a <% response.buffer = true %> at the top of your page. This allows you to process a response.redirect after you have already generated some html.
|
====== Doug G ====== Computer history and help at www.dougscode.com |
 |
|
benjamin64
New Member

84 Posts |
Posted - 24 July 2003 : 12:17:06
|
Thanks that did work fine, now it is working
is it possible to make, a redirection, if anyone try to come into any other pages beside the mainpage.asp.
they should could go form the main.asp and to the other sides
|
 |
|
Doug G
Support Moderator
    
USA
6493 Posts |
Posted - 24 July 2003 : 20:22:31
|
One way is to set some session value from the main page, and test for the session value on all the other asp pages, redirecting to the main page if the session value isn't set. If you don't mind using session variables this works pretty well. |
====== Doug G ====== Computer history and help at www.dougscode.com |
 |
|
tomasalsbro
Average Member
  
Sweden
818 Posts |
Posted - 04 November 2003 : 06:54:47
|
Hi,
I have the same problem and have followed Dougs advice, but it didn't help.
The problem can bee seen at the news category part of my site - Whiplash Info.
Cheers / Tomas |
!-Keep distance in traffic-! www.whiplashinfo.se |
 |
|
tomasalsbro
Average Member
  
Sweden
818 Posts |
Posted - 04 November 2003 : 14:30:28
|
! -- Bump -- ! |
!-Keep distance in traffic-! www.whiplashinfo.se |
 |
|
|
Topic  |
|