index out of range exception when storing into asp.net session -
please bare me, i'm new asp.net.
i'm building web app build report, there many arguments give each 1 name, , want save them indexed numbers can handle them loops later on throughout application.
however, i'm getting index out of range on first session item(0)...as understand it, don't have instantiate session myself , should work right?
session[0] = txtcompliancecaseid.text; session[1] = ddlstate.selectedvalue; session[2] = txtactingsupervisor.text; session[3] = ddlrisktolerance.selectedvalue;
etc...
the session
object string dictionary; should store objects in string keys.
writing session[0]
or set first item in session state.
since session state starts empty, throws exception.
instead, should use strings, this:
session["compliance id"] = txtcompliancecaseid.text; session["state"] = ddlstate.selectedvalue; session["supervisor"] = txtactingsupervisor.text; session["risk tolerance"] = ddlrisktolerance.selectedvalue;
you can call add
method.
Comments
Post a Comment