Using HttpListener to host ASP.NET web application

This is a discussion on Using HttpListener to host ASP.NET web application within the CSharp forums in Programming Languages category; 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 ...

Go Back   Application Development Forum > Programming Languages > CSharp

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 12-13-2007, 05:20 AM
Hans-Jürgen Philippi
Guest
 
Default Using HttpListener to host ASP.NET web application

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


Reply With Quote
  #2  
Old 12-13-2007, 10:13 AM
Nicholas Paldino [.NET/C# MVP]
Guest
 
Default Re: Using HttpListener to host ASP.NET web application

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/...staspnet1.mspx


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

"Hans-Jürgen Philippi" <HJPhilippi@aol.com> wrote in message
news:eqlaNHXPIHA.4272@TK2MSFTNGP06.phx.gbl...
> 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
>


Reply With Quote
  #3  
Old 12-13-2007, 01:33 PM
=?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
Guest
 
Default RE: Using HttpListener to host ASP.NET web application

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


"Hans-Jürgen Philippi" wrote:

> 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
>
>
>

Reply With Quote
  #4  
Old 12-14-2007, 08:54 AM
Hans-Jürgen Philippi
Guest
 
Default Re: Using HttpListener to host ASP.NET web application

Hi Nicholas,


> 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.


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.


> 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/...1.mspxI'll see if this article points me to something I may have forgotten.Thanks anyway,Hans

Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 07:03 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.