Solved

Http Listener Context

Posted on 2013-06-21
3
383 Views
Last Modified: 2013-06-24
My code below keeps stopping at the context line
Dim ctx As HttpListenerContext = listener.GetContext()

No error...no exception..it just exits.

Any ideas?

        Using listener As New HttpListener()
            listener.AuthenticationSchemes = AuthenticationSchemes.Negotiate
            listener.Prefixes.Add("https://localhost/")
            listener.Start()

            Dim ctx As HttpListenerContext = listener.GetContext()
            ctx.Response.StatusCode = 200
            Dim name As String = ctx.Request.QueryString("name")

            Dim writer As New StreamWriter(ctx.Response.OutputStream)
            writer.WriteLine("<P>Hello, {0}</P>", name)

            writer.WriteLine("<ul>")
            For Each header As String In ctx.Request.Headers.Keys
                writer.WriteLine("<li><b>{0}:</b> {1}</li>", header, ctx.Request.Headers(header))
            Next
            writer.WriteLine("</ul>")

            writer.Close()
            ctx.Response.Close()
            listener.[Stop]()
        End Using

Open in new window

0
Comment
Question by:lrbrister
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 39268670
If you enclose it in try catch block then does it go to catch block?
0
 
LVL 15

Expert Comment

by:Minh Võ Công
ID: 39269501
0
 

Author Closing Comment

by:lrbrister
ID: 39271359
That did it, and I found the error.

And....

Duh on me!
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question