Session question

This is a discussion on "Session question" within the Classic ASP section. This forum, and the thread "Session question are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > Classic ASP

Notices




Closed Thread
 
LinkBack Thread Tools
  #1  
Old Jul 22nd, 2004, 08:55
Junior Member
Join Date: Jul 2004
Location: United Kingdom
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Session question

Hi all!!.

I have just joined recently and posted a question and must say I got a great response and the answer I need. GR8 stuff!!.

I am using <%Session("image_path") ="/images"%> for my images path and I need to do the same for my global CSS page so I don't have to include it on every page.

Can someone please help me with writing the code? I am a newbie to this and those ASP books are so dam thick! And working in IT we just don't have to time to read them!... Lol.

Thanks guys and gals :-)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!

  #2  
Old Jul 22nd, 2004, 09:44
Rob's Avatar
Rob Rob is offline
Webforumz Founder
Join Date: Jul 2003
Location: Southern UK
Age: 34
Posts: 3,186
Blog Entries: 7
Thanks: 27
Thanked 23 Times in 20 Posts
I must say, you will find it better and more reliable NOT using session variables for image paths...

What you are doing is relying on the browser to tell the server where it's images are, only for the server to then turn round to the browser and say exactly the same thing.... pointless?

Now, i don't know about other people out there, but I reject the majority of cookies on my my machine (Session variables are stored in cookies on the visitors browser).

If someone rejects the cookie, or has them disabled, then POW!... your site is broken.

Instead, always refer to paths as relative to the root...

For instance say you have 2 asp pages.... one located at
yourserver.com/deep/content/here.asp
and another here
yoursever.com/somepage.asp

They can both refer to images in EXACTLY the same way....
for example: [img]/images/myimage.jpg[/img]
It matters not where the file is that contains this code, it will
always look in the same place, and in this case:-
yourserver.com/images/myimage.jpg

The magic (if you wanna call it that) with the above is that the image path BEGINS with a / and therefore
will tell the browser to find the path relative to the root.

You can employ this method also for your CSS file, and any other resources needed by the browser... for instance
Javascripts (ARRRGHHH!!) or Flash files!

Never use session variables or cookies (or javascript for that matter) unless it's absolutly 100% nessesary, and there is no other way.

Hope this helps.
__________________
Click the 'Thanks!' button if this post has helped you

Rob - Webforumz Founder
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #3  
Old Jul 22nd, 2004, 11:15
Junior Member
Join Date: Jul 2004
Location: United Kingdom
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Hey there Rob,

My goodness I have just clicked!.... sorry but being new at this I didn't realise something. I thought you needed the session variable AND the /image path to make it all work. I have now realised that I don't need the Session Variable at all!. Doh!. I have now done this with my CSS page and it's all works fine!. Thanks so much for your advice and yes it makes total sense.

Thanks again!

Freebirdnz
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Closed Thread

Tags
session, question

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Session variables ideleon PHP Forum 2 Feb 7th, 2006 08:04
session problem fender79 Classic ASP 8 May 18th, 2005 02:26
session php iamzoli PHP Forum 2 Apr 7th, 2004 05:49
Session Variables ekendricks Classic ASP 4 Dec 19th, 2003 06:33
Session Variables ekendricks Classic ASP 7 Aug 26th, 2003 10:42


All times are GMT. The time now is 04:02.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42