Ho letto un articolo su questo argomrnto, ma non ci ho capito un granchè, anche perchè era in c#, mi potete spiegare come posso leggere una variabile di sessione creata in asp con una pagina aspx?
Ho letto un articolo su questo argomrnto, ma non ci ho capito un granchè, anche perchè era in c#, mi potete spiegare come posso leggere una variabile di sessione creata in asp con una pagina aspx?
Ciao By Peter_Pan...
guarda qua http://forum.html.it/forum/showthrea...hreadid=453453
punto 3
io ho trovato quest'esempio ma non riesco a farlo funzionare, vorrei capire come funziona, mi date una mano?? quello che non ho capito è il codice che va nella pagina aspx, anche perchè a me serve per vb.
qui
Ciao By Peter_Pan...
sto cercando di ricostruire il tutto ma mi sta ritornando sempre un errore che non capisco, vi posto il codice che ho fatto e l'errore mi date un occhio?
L'errore è:codice:Dim strURL As String strURL = HttpContext.Current.Request.ServerVariables("SERVER_NAME") strURL += HttpContext.Current.Request.ServerVariables("SCRIPT_NAME") strURL = "http://" + strURL.Substring(0, strURL.LastIndexOf("/")) + "/readAsp.asp?type=Application&name=ConnectionString" If IsPostBack Then Dim myRequest As HttpWebRequest = CType(WebRequest.Create(strURL), HttpWebRequest) Dim myResponse As HttpWebResponse Try myResponse = CType(myRequest.GetResponse(), HttpWebResponse) Catch ex As Exception End Try Dim sr As StreamReader = New StreamReader(myResponse.GetResponseStream()) Dim contenuto As String = sr.ReadToEnd Response.Write(contenuto) End If
Message "The remote server returned an error: (401) Unauthorized." String
Ciao By Peter_Pan...
sono quasi riuscito vi posto il codice corretto:
In pratica se metto sr.ReadToEnd nel watch mi visualizza la variabile application, però nella text non mi stampa niente perchè???codice:Dim strURL As String strURL = HttpContext.Current.Request.ServerVariables("SERVER_NAME") strURL += HttpContext.Current.Request.ServerVariables("SCRIPT_NAME") strURL = "http://" + strURL.Substring(0, strURL.LastIndexOf("/")) + "/readAsp.asp?type=application&name=ConnectionString" If IsPostBack Then Dim myRequest As HttpWebRequest = CType(WebRequest.Create(strURL), HttpWebRequest) Dim myResponse As HttpWebResponse Try myResponse = CType(myRequest.GetResponse(), HttpWebResponse) Catch ex As Exception ex.ToString() End Try Dim sr As StreamReader Dim contenuto As String sr = New StreamReader(myResponse.GetResponseStream()) txtContenuto.Text = sr.ReadToEnd().ToString End If
Ciao By Peter_Pan...
up
Ciao By Peter_Pan...