2 Imports System.Web.Services
\r
7 Public Class feedproxy1
\r
8 Implements System.Web.IHttpHandler
\r
10 Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
\r
13 'Dim URL As String = "http://www.jackslocum.com/yui/feed/"
\r
14 Dim URL As String = context.Request.Form("feed")
\r
15 'Only allow http:// prefix
\r
16 If IsNothing(URL) Then
\r
19 If URL.Substring(0, 7) = "http://" Then
\r
21 'Dim enc As Encoding = Encoding.GetEncoding("UTF-8")
\r
22 Dim enc As Encoding = Encoding.GetEncoding("ISO-8859-1")
\r
24 Dim request As HttpWebRequest = WebRequest.Create(URL)
\r
25 Dim response As HttpWebResponse = request.GetResponse()
\r
26 Dim reader As StreamReader = New StreamReader(response.GetResponseStream(), enc)
\r
27 Dim str As String '= reader.ReadLine()
\r
28 Dim reply As String = ""
\r
29 'Do While str.Length > 0 And Not reader.EndOfStream
\r
30 Do While Not reader.EndOfStream
\r
31 str = reader.ReadLine()
\r
32 reply &= str & vbCrLf
\r
33 'Console.WriteLine(str)
\r
35 context.Response.ContentType = "text/xml"
\r
36 context.Response.ContentEncoding = enc
\r
37 context.Response.Cache.SetExpires(DateTime.Now.AddSeconds(60))
\r
38 context.Response.Cache.SetCacheability(HttpCacheability.Public)
\r
40 context.Response.Write(reply)
\r
41 Catch ex As Exception
\r
48 ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
\r