Create your own Web Server using C#

Compilation & Execution

To compile the program from the command line:

Compile.gif

In my version of .net I don't need to specify any library name, may be for old version we require to add the reference to dll, using /r parameter.

To run the application simply type the application name and press Enter..

RunApp.gif

Now, let say user send the request, our web server will identify the default file name and sends to the browser.

HtmlOutput.gif

User can also request the Image file..

ImgOutput.gif

Possible Improvements

There are many improvements can be made to the WebServer application. Currently it does not supports embedded images and no supports for scripting. We can write our own Isapi filter for the same or we can also use the IIS isapi filter for our learning purpose. The code to write basic Isapi filter is very well explained at ISAPI Filters: Designing SiteSentry, an Anti-Scraping Filter for IIS

Conclusion

This article gives very basic idea of writing Web server application, lots of improvement can be done. I'll appreciate if I can get any comments on improving the same. I am also looking forward for adding the capabilities of calling Microsoft Isapi Filter from this application.

You might also like...

Comments

About the author

Imtiaz Alam United States

Imtiaz Alam is a Senior Developer, currently residing in Phoenix, Arizona. He has more than five years of development experience in developing Mirosoft based Solution.

Interested in writing for us? Find out more.

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“C++: an octopus made by nailing extra legs onto a dog.” - Steve Taylor