Losing session variable problem...help!

Reply

Join Date: Oct 2005
Posts: 33
Reputation: edmicman is an unknown quantity at this point 
Solved Threads: 0
edmicman's Avatar
edmicman edmicman is offline Offline
Light Poster

Losing session variable problem...help!

 
0
  #1
Oct 28th, 2005
I've implemented a security method where a user goes to a page, if they are are session authenticated, they redirect to a central login page, and then if they login correctly they are redirected back to the originating page with the session variable true. I'm basically using javascipt to accomplish this at the top of each file I want to protect:

  1. if(Session("Authenticated") != "-1")
  2. {
  3. var curLoc = "http://" + Request.ServerVariables("SERVER_NAME") + Request.ServerVariables("URL");
  4. Response.Redirect("http://" + Request.ServerVariables("SERVER_NAME") + "/security/login.asp?destPage=" + curLoc);
  5. }

The destination page is passed in the querystring, and that's how it knows where to go back to. Our servers are set up so that we have a production server, and then the test server is a virtual directory off the main web, so our paths look like intranet.domain.com, and our test environment is test.domain.com, but they are technically in the same "website" under IIS.

My process works in the test environment, but doesn't in the production environment. It is the same code, so I don't know what else could be causing it to have problems. The redirects are working, and the login is passing, its just not getting the session variable in the prod setting - it just goes in an endless loop. What else can I look for that might be different between the two domains? Thanks!
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 483
Reputation: campkev is an unknown quantity at this point 
Solved Threads: 19
campkev campkev is offline Offline
Posting Pro in Training

Re: Losing session variable problem...help!

 
0
  #2
Oct 28th, 2005
shouldn't that be
  1. if(Session("Authenticated") != "-1")
  2. {
  3. var curLoc = "http://" + Request.ServerVariables("SERVER_NAME") +"/"+ Request.ServerVariables("URL");
  4. Response.Redirect("http://" + Request.ServerVariables("SERVER_NAME") + "/security/login.asp?destPage=" + curLoc);
  5. }
Reply With Quote Quick reply to this message  
Join Date: Oct 2005
Posts: 33
Reputation: edmicman is an unknown quantity at this point 
Solved Threads: 0
edmicman's Avatar
edmicman edmicman is offline Offline
Light Poster

Re: Losing session variable problem...help!

 
0
  #3
Oct 28th, 2005
Originally Posted by campkev
shouldn't that be
  1. if(Session("Authenticated") != "-1")
  2. {
  3. var curLoc = "http://" + Request.ServerVariables("SERVER_NAME") +"/"+ Request.ServerVariables("URL");
  4. Response.Redirect("http://" + Request.ServerVariables("SERVER_NAME") + "/security/login.asp?destPage=" + curLoc);
  5. }
Hmmm, for some reason it isn't, or at least your code puts an extra "/" in. The Request.ServerVariables("URL") is including the leading "/". I dunno, our setup is messed up, the test environment is different than the prod environment, no one knows whats all been done to each, and I'm trying to find a needle in a haystack to figure out what small difference is causing this problem!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC