asp.net - Assign TextBox Value to the session in MVC -


in mvc application used input type textbox , need assign value session how?

im using code like

<input type="text" id="textbox1" name="namebox" /> <input type="text" id="textbox2" name="agebox" />  <% httpcontext.current.session["name"] =textbox1; %> <% httpcontext.current.session["age"] = textbox2; %> 

but got error pls on this....

why prefer session instead of hidden input box? well, think should use name rather id of textbox.

try , let me know if there problem.

<input type="text" id="textbox1" name="namebox" /> <input type="text" id="textbox2" name="agebox" />  <% httpcontext.current.session["name"] = namebox; %> <% httpcontext.current.session["age"] = agebox; %> 

Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -