Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
<%
Dim sT
if Request.ServerVariables("REMOTE_ADDR") = Request.ServerVariables("LOCAL_ADDR") Then
sT = Request("SessionVar")
if Trim(sT) <> "" Then
Response.Write Session(sT)
End If
End If
%>
Imports Microsoft.VisualBasic
Imports System.Net
Imports System.IO
Public Class ASPSessionVar
Dim oContext As HttpContext
Dim ASPSessionVarASP As String
Public Function GetSessionVar(ByVal ASPSessionVar As String) As String
Dim ASPCookieName As String = ""
Dim ASPCookieValue As String = ""
If Not (GetSessionCookie(ASPCookieName, ASPCookieValue)) Then
Return ""
End If
Dim myRequest As HttpWebRequest = CType(WebRequest.Create(ASPSessionVarASP + "?SessionVar=" + ASPSessionVar), HttpWebRequest)
myRequest.Headers.Add("Cookie: " + ASPCookieName + "=" + ASPCookieValue)
Dim myResponse As HttpWebResponse = CType(myRequest.GetResponse(), HttpWebResponse)
Dim receiveStream As Stream = myResponse.GetResponseStream()
Dim encode As System.Text.Encoding = System.Text.Encoding.GetEncoding("utf-8")
Dim readStream As StreamReader = New StreamReader(receiveStream, encode)
Dim sResponse As String = readStream.ReadToEnd()
myResponse.Close()
readStream.Close()
GetSessionVar = sResponse
End Function
Private Function GetSessionCookie(ByRef ASPCookieName As String, ByRef ASPCookieValue As String) As Boolean
ASPCookieName = ""
ASPCookieValue = ""
For Each myCookie As String In oContext.Request.Cookies
If myCookie.StartsWith("ASPSESSION") Then
ASPCookieName = myCookie
ASPCookieValue = oContext.Request.Cookies(myCookie).Value
Return True
End If
Next
Return False
End Function
Public Sub New(ByRef oInContext As HttpContext)
oContext = oInContext
ASPSessionVarASP = "SessionVar.asp"
Dim oURL As System.Uri = oContext.Request.Url
ASPSessionVarASP = oURL.Scheme & "://" & oURL.Host & ":" & oURL.Port.ToString() & "/" & ASPSessionVarASP
End Sub
End Class
Dim MyVar as ASPSessionVar = New ASPSessionVar(HttpContext.Current)
Dim username As String = MyVar.GetSessionVar("username")