Visual Studio 2005
(1)
CreateApplicationHost
(1)
HttpListener
(1)
ASP.NET
(1)
Site
(1)
MetaFinder
(1)
CodeBehind
(1)
UnBlog
(1)

Using HttpListener to host ASP.NET web application

Asked By Hans-Jürgen Philippi
13-Dec-07 05:20 AM
Hi Group,

I've created a (very simple) ASP.NET web application with a single *.aspx
page and an *.aspx.cs CodeBehind file: By clicking an HTML form button, a
text control value is written into a label below using a click handler and a
server roundtrip.
Pretty nifty, I know...

Now I want to run this app hosted by an own web server, an HttpListener
based C# application I've created with Visual Studio 2005 - what doesn't
work. The *.aspx page gets published but obviously the actual server
operation/click handler is not executed, the label stays blank and after the
server roundtrip the text control is empty again, no session seems to be
managed although the corresponding hidden form values are there.

Any idea what may be different when the web application runs fine with the
ASP.NET development server launched by Visual Studio? What to look for to
have a web application hosted by an own HttpListener based approach?

Thanks in advance + greetings,
Hans

Hans, When you use the HttpListener, all it does is provide an interface

Asked By Nicholas Paldino [.NET/C# MVP]
13-Dec-07 10:13 AM
Hans,

When you use the HttpListener, all it does is provide an interface for
HTTP clients to connect to.  It does NONE of the underlying work to actually
process the page.

You can actually host the ASP.NET runtime in your own app.  Here is an
article which explains how to do it:

http://www.microsoft.com/belux/msdn/nl/community/columns/desmet/hostaspnet1.mspx


--
- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com

Suggest that you take a look at the "Cassini" managed web server code.

Asked By pbromber
13-Dec-07 01:33 PM
Suggest that you take a look at the "Cassini" managed web server code. There
are several versions that people have enhanced. Search and you will find.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
MetaFinder: http://www.blogmetafinder.com

Hi Nicholas,I guess I should have mentioned more explicitely that the

Asked By Hans-Jürgen Philippi
14-Dec-07 08:54 AM
Hi Nicholas,



I guess I should have mentioned more explicitely that the application I've
created actually does involve the CreateApplicationHost() method and thereby
the ASP.NET runtime. As I've said before: The hidden HTML form session
variables are created, but nevertheless the most simple page functionality
is not executed.


http://www.microsoft.com/belux/msdn/nl/community/columns/desmet/hostaspnet1.mspxI'll see if this article points me to something I may have forgotten.Thanks anyway,Hans
Post Question To EggHeadCafe