Server Variables

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
taylorpd
Beginner
Beginner
Posts: 3
Joined: Mon Nov 06, 2006 9:20 am

Server Variables

Post by taylorpd »

I am trying to collect some server variables in order to personalise / manage selections in the menu URLs.
I have sorted the URL aspect but cannot get the server request code to work in the menu file i.e. like this example:

Code:
function getSessionURL()
{
var SessionURL = Server.HTMLEncode(Request.ServerVariables("AUTH_USER"));
return SessionURL;
}

I'm sure its something simple but as a beginner, any help would be appreciated.
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

How do you want to incoporate the return of getSessionURL into the menu, as part of a menu item's url property? Help me to understand that, and I'll try yo show you how.

Cheers,

Kevin
taylorpd
Beginner
Beginner
Posts: 3
Joined: Mon Nov 06, 2006 9:20 am

Post by taylorpd »

To employ as a URL variable for individualisation is exactly how I would like to employ these server variables.

Thanks

paul
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

Hi Paul

Still not 100% sure where you want this in the menu code, but I'll take a stab. I'm assuming from your code snippet that you're using javascript as your ASP scripting language, rather than VBScript.

First, is your js code inline, in the main ASP file, or are you loading the menu's js code from an external file? If you're loading it from a separate file, remember to use .asp as the filename extension (e.g., menu_data.asp rather than menu_data.js), otherwise, the asp statements in the file won't be processed when the file is served... they'll be interpreted by the browser as js code and cause an error.

So:

to use the return of getSessionURL() in the url property of a a menu item definition:

Code: Select all

aI("text=Item Text; url=<%=getSessionURL()%>;");
Hope that helps,

Kevin
taylorpd
Beginner
Beginner
Posts: 3
Joined: Mon Nov 06, 2006 9:20 am

Post by taylorpd »

Kevin
Thanks for you patience!
I started by downloading the frames sample and customising to suit hence the code I am trying to get to work is in the menu_data_body.js file which is loaded by the body asp file.
On other asp pages, I have code working that collects and displays various Server.HTMLEncode variables.
Also I found other downloads that work in the menu body file and allow a varibale to be used in the actaul menu items but I just cannot get these server variables to work.
It was my intention to keep the code in the js files rather than filling out each individual asp file that might get loaded into the body frame.
I tried yor suggestion of building it into the asp file but to no avail.
Post Reply