views:

577

answers:

1

Is there a way to add a custom prefix/URI that is not http or https? The HTTPListener.Prefixes.Add method only accepts http:// and https:// prefixes.

I just don't want to recreate the functionality of this class if I don't have to.

+1  A: 

What did you have in mind? Mainly, I doubt it; besides, it will still only handle http[s], so why confuse things with a different scheme name? You can listen on a different port by adding it to the prefix list (eg "http://127.0.0.1:90/"), though. If a client connects on that port using the correct protocol (http vs https) then it would probably work - you'd just have a lot of work to do at the client to tell it how to handle that scheme.

I'm not sure I see a point, to be honest...

Marc Gravell
It's for a custom protocol. I didn't want to write the server from scratch, but it looks like that will be the case. I already have the client part figured out.
hectorsosajr
Yes, I suspect you will need to write your own sockets server; HttpListener (as the name suggests) has lots of http[s]-specific logic.
Marc Gravell