Ciao a tutti, vi posto il codice qui di seguito:
txtURL é una textbox, mentre myPage é un literal.codice:Imports System.Net Imports System.IO Partial Class _Default Inherits System.Web.UI.Page Dim u As String Dim webC As WebClient Dim stream As Stream Dim streamRdr As StreamReader Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load u = txtURL.Text If u = "" Then u = "http://www.google.com" End If webC = New WebClient() webC.Credentials = System.Net.CredentialCache.DefaultCredentials stream = webC.OpenRead(u) streamRdr = New StreamReader(stream) myPage.Text = streamRdr.ReadToEnd() stream.Close() End Sub End Class
Il codice funziona e fa da proxy effettivamente, il solo problema é che ad esempio andando su youtube, quando premo su un link per vedere un filmato vengo rimandato ad un link simile a questo "http://localhost:2616/watch?v=wJ2L1aQy", cioé la parte iniziale dell'URL diventa il dominio corrente del sito, in questo caso localhost, mentre la seconda parte é il riferimento effettivo del filmato. Per ovvenire a questa cosa dovrei intercettare il rimando ai link, qualcuno ha idea di come possa fare?

Rispondi quotando