' Collection of code snippets by Arne Vajhøj ' posted to eksperten.dk, usenet and other places (2002-now) Imports System Imports System.Collections.Specialized Imports System.IO Imports System.Net Namespace E Public Class WebServer Public Shared Sub Main(args As String()) Dim srv As New HttpListener() srv.Prefixes.Add("http://localhost:800/") srv.Start() While True Dim ctx As HttpListenerContext = srv.GetContext() Dim req As HttpListenerRequest = ctx.Request Dim resp As HttpListenerResponse = ctx.Response Console.WriteLine(req.Url.AbsolutePath) For Each k As String In req.Headers.AllKeys Console.WriteLine(k & " = " & req.Headers(k)) Next For Each k As String In req.QueryString.AllKeys Console.WriteLine(k & " = " & req.QueryString(k)) Next Dim sw As New StreamWriter(resp.OutputStream) sw.WriteLine("Det virker") sw.Close() End While 'srv.Stop(); 'srv.Close(); End Sub End Class End Namespace