How to record content in a classic Asp Session and move to a mvc page?

Asked

Viewed 2,411 times

1

How to record the checkbox in a session to be able to use it on another page ? It is possible ?

3 answers

2

In this link you can have all session usage documentation with Asp.

Follow a brief example:

<%
Session("usuario")="João"
Session("idade")=50
%>

I hope I’ve helped.

2

See the code below:

Default page.

<body>
<form method="post" method="sessao.asp">
    <input type="checkbox" name="ckb" value="1234"> Enviar o valor 1234 deste checkbox.<br>
    <input type="submit" value="Enviar">
</form>
</body>
</html>

Page sessionAsp.

<%
'Recebe o valor do checkbox e atribui a sessão.
session("ckb") = request.form("ckb")
response.write(session("ckb"))
%>

2


Only by complementing the responses there is another property of ASP called "Application" and it has basically the same function of "Session" or save a value globally, but the difference between them is that "Session" is applied only to a user and "Application" works for all users.

<%
Application("usuario")="João"
Application("idade")=50

Response.Write Application("usuario") & " - " & Application("idade")
%>

References:
Applications W3school
MSDN Application and Sessions

  • helped a lot also, except that I saw here that the problem is another, I do not have the source of the project and it is mixed, a part in classical Asp and another in mvc, I need to pass the value of the checkbox to a page in mvc. Do you know how I can do that ? And I didn’t want to record it in the bank either.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.