Question

I was wondering if it was possible to setup the HttpListener to process normal C# <%%> code? So essentially I have a programming running an HttpListener right now, and all it does is replace $varname with whatever variable I want to output.

What I would like to do is to use a type of server side script to access all the different variables and methods in my application.

Is such a thing possible?

I looked a bit into Microsoft.CSharp.CSharpCodeProvider but I was thinking there might be a built in way that I'm not aware of.

Essentially I have an application that is a server for a client-server app, and I want to add a web gui to it so that I can call methods, and get variables and such.

Thanks.

Was it helpful?

Solution

You may take a look at the following article. It illustrates how you could use an HttpListener to host the ASP.NET runtime and be able to process ASPX pages. It uses an HttpListenerContext and an HttpWorkerRequest.

OTHER TIPS

Don't know if it's exactly what you want to do, but if you would use IIS and ASP instead of a httplistener, Page.ParseControl can take a string as input, so you could parse and execute an arbitrary code block. Of course watch your input, and maybe you are forced to use a httplistener...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top