PoshCode Archive  Artifact [f9d8866fd2]

Artifact f9d8866fd235b0778bde9d3d10b6de73509f3bb3c8f058b73462810754d4b6f4:

  • File Asp-net-Using-httpConext.ps1 — part of check-in [064f65d83f] at 2018-06-10 13:10:20 on branch trunk — ASP.NET – Using httpContext (user: ti4funcom size: 1093)

# encoding: ascii
# api: powershell
# title: Asp.net-Using httpConext
# description: ASP.NET – Using httpContext
# version: 0.1
# type: class
# author: ti4funcom
# license: CC0
# x-poshcode-id: 2443
# x-archived: 2011-01-10T08:48:26
#
#
 Default.aspx
----------------


Partial Class _Default
Inherits System.Web.UI.Page

Dim var1 As String
Dim var2 As String

Protected Sub lnk_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnk.Click
Context.Items("Nome") = var1
Context.Items("Email") = var2

Server.Transfer("pagina3.aspx")
End Sub

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
var1 = "20091005"
var2 = "20091106"
End Sub
End Class


pagina3.aspx
--------------------------

Partial Class pagina3
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim context As HttpContext = HttpContext.Current

Label1.Text = CStr(context.Items("Nome"))
Label2.Text = CStr(context.Items("Email"))
End Sub
End Class