Jump to content
MakeWebGames

ASP vs ASP.NET vs C#


a_bertrand

Recommended Posts

Somebody asked me what is ASP, and what is ASP.NET and what is C# and how all those are related.

I will try here to explain it briefly.

ASP

ASP was the answer from Microsoft to language like PHP which allowed to easily create dynamic web sites. Actually ASP is a lot similar to PHP just way not as good. It was so bad actually that I doubt there was some real usage, anyhow this was before ASP.NET and I must say wasn't a good product. I never used it and I will never use it either. There is still some people which didn't switch to the newer solution called ASP.NET but hey, some people simply can't see advantages even if you put them in front of the facts.

So how ASP worked? Basically exactly like PHP, the main difference is the tag <% some code %> where PHP uses the well known <?PHP ?>. As PHP you was mixing the HTML and the code all in one file, and as PHP it was interpreted when called. The syntax was a special version of VisualBasic, and that's it. Nothing that fancy.

ASP.NET

ASP.NET is so different from ASP that it would have been wiser for Microsoft to change completely name, yet they kept the same name to try to help mentally the users of ASP to switch to the new solution even if in most case it is incompatible with the previous ASP pages. On the other side, keeping the same name confuse new users, and actually gives a bad opinion on it as some people do know how bad was the old ASP. I can't however decide for them the name, so let it be for the moment.

ASP.NET works on the concept that is a framework for web development for the .NET framework. What? Wait! What is the .NET framework (framework / platform / library / virtual machine... .NET is all that) ? Simply put, the .NET framework is the official way to develop on Microsoft platform and could be considered the Java from Microsoft. (I will compare .NET to Java in an other thread if you don't mind)

Let's say to simplify that .NET handle all the work you may expect from a base package like open files, have arrays, lists, sort, crypt, compress and even more advanced things like access web page, ftp sites, parse XML, connect to databases and whatever else you may have in mind. Really .NET is extremely complete. It is like having the full PEAR PHP + Zend framework all directly in one package.

As said, ASP.NET is sitting on top of the .NET frameworkand let you create web pages. But not simply by echo or print HTML dynamically, no instead it takes the concept of components and events. Components can be anything visible or to user which compose a web page. A component can be something as simple as a <h1> tag or to tree, calendars, or even html editors. A component can include images, js, css, html and whatever else you may want. On the other side, you have the events, an event is a message a component send to your application. For example if I have a page with <INPUT TYPE=BUTTON> and the user press it, instead of reading the $_GET or $_POST variables to spot that, I get waked up in a function linked to the button itself. That means, this function will be called every time a user press that button. As components can be more complex, you may thing you may get waked up when a user want to save, or make a typo or whatever events the component offer. Finally, one of the big strength of ASP.NET is the fact that you can decouple (and should decouple) the HTML from the code itself. So normally web pages are composed of two pages, for example one myfile.aspx and a myfile.aspx.cs (for C#). The first one is the ASP.NET page, which will remain like it is on the server. The second one is the one which contains your code / logic and is called code behind. This file will then be compiled with all the code behind pages into a DLL and only that DLL will be sent / run on the server. That means, if you develop something you do not share your sources with the person running it. That's already a huge advantage, the second huge advantage is that the look & feel is decoupled from the code and therefore like with a template system, you can change the look without touching at all at the code. Finally, another appreciable advantage is that as the code is compiled it will run faster than an interpreted (ASP or PHP) code.

C#

So far we discussed little about C#, and it was on purpose. As .NET and ASP.NET have basically not much to do with C#. C# is a pure language and is not directly related to .NET and ASP.NET. It is so true that you can code .NET / ASP.NET in VisualBasic (VB.NET), F#, JScript, IronPython or any other of the .NET supported languages.

So C# is just the syntax of the language with a few specific things like name spaces, where .NET is the real library and the one which offers you the opportunity to do something with the language.

Windows / Linux / others

I said it multiple times, but let's say it once more. ASP.NET / .NET is not directly linked to windows even if it is produced by Microsoft. Or let's say, code developed for .NET can be run on other platforms as well. I do personally develop on Windows (as I find it more comfortable) and then deploy / run some of my soft on Linux. This is possible thanks to the Mono project (an open source project) which do get some support from Microsoft and from Novell. Mono allows you to run most if not all .NET application on any Linux distributions as well as on Mac OSx. You may also develop for iPhone and Android phones with it.

http://www.mono-project.com/Main_Page

Link to comment
Share on other sites

  • 1 year later...
  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...