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.
|
|
|
|
|
![]() |
||
Session question
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
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 :-) |
|
|
|
#2
|
||||
|
||||
|
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
Last Blog Entry: Creative Labs threaten developer over home made drivers.... (Apr 1st, 2008)
|
|
#3
|
|||
|
|||
|
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 |
![]() |
| Tags |
| session, question |
| Thread Tools | |
|
|
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 |