ASP does not save session data

2

I have a page that logs in to the client. This page goes up to the session id and client name like this:

session("user_id") = rec_user("chave")
session("user_name") = rec_user("nome)

I have another page that uses this information to verify that the user is logged in:

if session("user_id") = "" then
    response.redirect("login.asp")
else
    'exibe a página
end if

The problem is that the page that performs the verification never receives data from session . I found the error odd for two reasons:

  • 1st as soon as I entered the data in the session , on the login page, end a check to see if they were there, and returned positive.
  • 2nd is another login page, which looks for users in a secondary table, but redirects to the same verification page, and, strangely, the data uploaded to the session of this other login page is seen perfectly by verification page.
asked by anonymous 01.05.2014 / 14:05

1 answer

2

Well guys. I found the problem and I will share it. The page redirection was complete with www. Example

response.redirect('http://www.exemplo.com')

But if the user accesses without the WWW (example.com) in the browser, the page that receives the redirect (which comes with www in the url) does not see the session created on the page that saved the data with url without www. Here's the explanation why one login page works and another does not. The solution was simple, remove the redirection with full url and place with relative url.

    
08.05.2014 / 22:55