Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 redirection
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

benjamin64
New Member

84 Posts

Posted - 18 July 2003 :  08:11:14  Show Profile
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  Show Profile
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.
Go to Top of Page

benjamin64
New Member

84 Posts

Posted - 24 July 2003 :  06:41:53  Show Profile
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>
Go to Top of Page

Doug G
Support Moderator

USA
6493 Posts

Posted - 24 July 2003 :  12:02:41  Show Profile
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
Go to Top of Page

benjamin64
New Member

84 Posts

Posted - 24 July 2003 :  12:17:06  Show Profile
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
Go to Top of Page

Doug G
Support Moderator

USA
6493 Posts

Posted - 24 July 2003 :  20:22:31  Show Profile
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
Go to Top of Page

tomasalsbro
Average Member

Sweden
818 Posts

Posted - 04 November 2003 :  06:54:47  Show Profile  Visit tomasalsbro's Homepage
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
Go to Top of Page

tomasalsbro
Average Member

Sweden
818 Posts

Posted - 04 November 2003 :  14:30:28  Show Profile  Visit tomasalsbro's Homepage
! -- Bump -- !

!-Keep distance in traffic-!
www.whiplashinfo.se
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.31 seconds. Powered By: Snitz Forums 2000 Version 3.4.07