views:

358

answers:

1

First of all, I got a question

in .asp page

Class clsTesting

Function hash_call ( methodName,nvpStr )

.....
Set SESSION("nvpReqArray")= deformatNVP( nvpStrComplete )
.....

End Function

end class

When I perform call to this function, once reach the Set SESSION("nv line it say error:

Microsoft VBScript runtime (0x800A01A8)
Object required: 'session'

How do I define the variable? I tried dim SESSION, dim SESSION("nv... not working!

Is it run it outside of class, then no need to declare those variables?

+2  A: 

Try:

Session["nvpReqArray"] = deformatNVP( nvpStrComplete )

You don't need to define a session variable, it's one of the built in objects of asp3.

Edit:

Option explicit is a directive which forces you to declare all variables. (As you've noticed.).
This aids programming, and helps ensure variables are used consistently.
I would recommend you using it.

Bravax