Click to See Complete Forum and Search --> : Redirection from within an include


zingmatter
10-25-2004, 04:12 AM
Hi

I have a site where the content (stored in a separate directory as plain html without headers) is added to a template in the form of an include, i.e.

the link for a page might be:

<a href="template.asp?content=pagecontent">some link</a>

and in the template.asp file there's the code:


<%

server.execute("content/" & request.querystring("content") & ".asp")

%>


My problem is that if someone (say via a search engine) goes directly to the content page, e.g. content/pagecontent.asp I want the content to be automatically inserted into the template having detected that is wasn't called by template.asp

Is there a way of detecting a direct link (rather than a server.execute() call) and so force the page to reload inside the template. This of course all will happen at the server.

Any ideas appreciated

javaNoobie
10-25-2004, 08:42 PM
You could probably try finding the referer or using cookies..

zingmatter
10-26-2004, 03:43 AM
Actually, I found a simple solution....

above the html just add


<%
if request.querystring("content") = "" then

response.redirect("../template.asp?content=" & pagecontent)

end if
%>

That did the trick, but thanks anyway