How to create session/cookie on the server with classic asp
I'm working on a shopping cart an开发者_StackOverflow中文版d I need to know what is the best/secure way to create session or cookie on the server. By the way I'm using classic asp.
Thanks in advance.
Just enable session on your IIS setting(if you are on 2003-2008 servers). On 2000 server it is enabled by default.
Then use simple variable assign-retrieve techniques.
To assign value use: session("name")= value
To retrieve value: value=session("name")
"name" is your assigned variable for which you want to have value to be preserved for duration of the session.
This way you always have your values secured and available for this specific customer and only for this session. Any other client will have his own set of values. And basically it is impossible to hack since those value discarded as soon as session ended.
Difference between classic asp session variable and NET session view state is that classic variables not written anywhere on the page and could not be hacked. NET on the other hand using session state which is written on each page and potentially can be hacked pretty easily.
精彩评论