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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with session variables 1

Status
Not open for further replies.

dataplayer

Programmer
Jan 11, 2003
95
US
my website has several application pages where I need to pass IDs from pages to pages. I use session variables, but the problems abound. I keep losing the values in the session variables. The possible causes are too many pages and use of different names for the same website. I can use query string to pass the IDs between pages, but security would be a issue because the strings are saved in the cookies file that may be stolen if users use public computers. Can anyone share some info how to get around this dilemma? Hints and suggestions are greatly appreciated.

Frank
 
The possible causes are too many pages and use of different names for the same website.
Are you saying that you have different names for your session variable on different pages?

traingamer
 
I meant the same site, say has other 2 mirror addresses, and both pointing to the same place However, cookies can do not know they are the same and can treat them as different site. So if someone visits the site using and click on a link to another page, say then the session ID of page1.asp will be discarded and a new session ID will be assigned to page2.asp. Thus the session variables on page1.asp can not be passed on to Page2.asp. That is one of the problems. I am think of changing all the absolute addresses in the source codes into relative addresses. But that involves a lot work and I don't know if there is any unexpected problem in the future. I like to hear some input on that option.

Thanks for reading and asking.

Frank
 
it's quite simple, sessions and cookies can't be shared between hostnames.

There will be far more problems with search engines ahead if you don't ensure that only one hostname can be crawled.

I don't undestand why you have mixed absolute addresses in the site.




Chris.

Indifference will be the downfall of mankind, but who cares?
Woo Hoo! the cobblers kids get new shoes.
Nightclub counting systems

So long, and thanks for all the fish.
 
Chris,

There is only one absolute address in all the pages in the site. But users can go to the site from the mirror addresses. Afterwards, when they click on any link, the absolute address will come up and cause loss of session.

we have to use the mirror addresses for conveniencing users and advertising. TI need to come up with a solution.

Frank
 
Two ways to fix it.

1/ use all relative URIs internally this will keep all sessions/cookies on the same hostname. This however will cause problems with search engine results.

2/ use 301 (Permanent) redirects to the primary domain from the other hostnames. You can still use the alternate hostnames for offline and email promotion but only the main hostname will show in the browsers.

Chris.

Indifference will be the downfall of mankind, but who cares?
Woo Hoo! the cobblers kids get new shoes.
Nightclub counting systems

So long, and thanks for all the fish.
 
Chris,

I decided to try relative URLs on some of the on-ling application pages where search engine functions are not critical, while keeping my index page and some info pages using absolute addresses for search engine functions. Thanks for the advice.

Frank
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top