Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help to start a session 1

Status
Not open for further replies.

upplepop

IS-IT--Management
Jun 1, 2002
173
0
0
US
I have a website that I would like to display two ways; either a menu bar is displayed on the left, or not.

If the user goes to www.mydomain.com, they should get the regular website with menu bar. However, if they go to www.mydomain.com/search, they should get the website without the menu bar.

I don't want to have to deal with replicating the site in two places and maintaining it.

Here's what I'm thinking so far. If someone goes to www.mydomain.com/search, I have an index.asp file that starts a session or writes a cookie and redirects to the regular website, which will have something like:

IF session <> "search" THEN
<!--#include file="menu.asp" -->
END IF

I need help making the aforementioned index.asp page and writing the IF/THEN statement.

thanks for your help!
 
Your pseudo code is actually fairly close. basically your redirect page would look something like:
Code:
<%
[b]search/default.asp[/b]
Option Explicit

'write a value to a session variable
Session("search") = True

'redirect
Response.Redirect "/default.asp"

And then your If statement would look something like:
Code:
If IsEmpty(Session("search")) Then
   <!--#include file="menu.asp" -->
End If

It's not necessary to set the session variable to true. I used the isEmpty function to check if it had been assigned any value, but you could just as easily check to make sure te value <> "" or assign it a string and check Len().
Just remember that even though the code from your include is only executed if the If statement is true, it will be included into the main code and will need to be syntactically correct, regardles of whether it is actually executed.

-T

signature.png
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top