How to create a web framework in C # without ASPX?

I managed to get the asp C # page running ubuntu / apache / mono, but I don’t want to write my framework on these ASP pages, I want to use direct C # and then I will use the language template for my views. But I do not know where to start?

C # is a compiled language, so ... how would I do it? Would I compile everything and then run apache into a (single) executable and pass in the request url? Can I request specific .cs pages and then ask apache to say that it compiles and then “display” it only if it has been updated? Is it possible to compile the "view" files so as not to recompile everything with every change? Is there some kind of “base” with which I can work, or will I have to reconsider access to GET and POST variables (reading header information) and all sorts of other things that we take for granted in languages ​​like PHP?

+6
c # apache mono web-frameworks
source share
5 answers

AFAIK there is no reason why you cannot do what you want on top of the ASP.NET kernel using things like HttpApplication, HttpHandler, etc. For example, you can redirect all URLs to one HttpHandler and take it manually from there.

I suggest taking a look at how ASP.MVC does it - create a new ASP.NET MVC project in MonoDevelop, look at Global.asax.cs, open Web.config and look at the custom handlers and HTTP modules it is registered. ASP.NET MVC is OSS, so you can delve into that too.

+3
source share

If you don’t like using ASP at all, you can try reading the source code for ASP and see how they implement the functions you need, such as access to POST and GET information, routing, session management, etc.

However, it will be a ton of work. What you can do is implement most of your logic in C # class libraries and just use ASP to “host” the application and pass the data you need.

+1
source share

No one will ask you to put heavy code on ASPX pages. (Please do not use ASP, this is another thing).

In the ASP.NET WebForms model, you can use Code Behind mode.

In the ASP.NET MVC model, you have much more control over all aspects.

Therefore, get rid of time and immerse yourself in existing models. Trying to deploy your own can be a waste of time.

Mono supports both models.

In addition, ASP.NET was designed in a way that is different from PHP, and you should be aware that introduces differences that may not always satisfy your requirements above.

+1
source share
  • You said ASP. Are these the ASP or ASP.NET pages you worked with? A big difference.
  • Can you access the request / response on the ASP.NET pages, if so, you can access the GET / POST.
  • Do you know how to create what you are trying to use in regular IIS / ASP.NET? If not, please save yourself in some sanity and, at least, working rudely there. This is just general advice on reducing the number of variables / unknowns you are working with at the same time.
  • Ultimately, you create your own handlers. I assume that you will need a DLL bit that will see the request for the xxx page, read that page, and instantiate the support class. A look at the source of asp.net mvc can help a lot (with additional downloads).
+1
source share

There are many alternative template languages ​​for ASP.NET MVC; see this question for the loooong list: ASP.NET MVC View Engine Comparison

+1
source share

All Articles