Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Http Listener Context

Posted on 2013-06-21
3
Medium Priority
?
388 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 2000 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

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
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…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

704 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