What is the difference between C# and ASP.NET?

Asked

Viewed 45,010 times

35

What’s the big difference about ASP.Net and C#? I program in C# for desktop, but I can’t understand.

C# para desktop (Windows Forms Application) is identical to the C# used in web programming? And the C# used in web programming is identical to the ASP?

8 answers

33


The C# you use is always the same, both for desktop and web (Asp.Net).

Asp.Net is the Microsoft technology you use to do the server-side part of web applications.

Don’t confuse this with ASP (classic ASP): This is an old and obsolete Microsoft technology that used Vbscript (or Javascript) as a language, before the Framework existed. NET.

  • 1

    How can it be the same C# on desktop and web? By chance on the Web I can add label, panel, textbox as in desktop version? Are there forms? I can’t understand...

  • 7

    @Lizard No, not exactly. Asp.Net has a Web Forms Framework that allows you to work in a similar way to Windows Forms (which gives you the illusion of being able to add Label, Button, Textbox, etc.). What I mean by "It’s always the same C#" is because the language is the same, but it changes the library. For desktop, for example, you use the System.Windows.Forms library, while for Asp.Net Web Forms, you use the System.Web.UI library.

  • 1

    I think I got it, just open my mind... If it’s web, it works with HTML, right? Finally, I adding a textbox, what effect does this textbox have (in this web Forms you commented on) in html code?

  • 3

    The Textbox of Web Forms is an "abstraction". That is, it is a kind of "illusion". Pro C#, it is a Textbox. Since Asp.Net knows that Html does not know what a Textbox is, Asp.Net transforms all its Textbox into a Textbox <input type="text" /> when "render" the client page.

  • 1

    I understood, he also does this about positioning and with all other C controls#?

  • 1

    Web Forms does not have ALL the controls of Windows Forms, but it has most, which behave similarly. The intention of Web Forms is to bring web development as close as possible to desktop development with Windows Forms. Still, it doesn’t stop you from using pure HTML, Javascript and CSS, so when it doesn’t meet some need for your positioning or style, you can adjust as you like.

  • 4

    As a note, I must say that the level of abstraction presented by Web Forms is harmful. The fact is that Microsoft tried to embellish this framework so much that it became heavy (for reasons of Viewstate, Postback and the like). And as a personal experience, I say that doing something that Web Forms does not provide in principle can become a great pain. I recommend that, if you want to do Web development with C#, use the MVC Framework, also official Microsoft and with more active development since a long time.

Show 2 more comments

21

ASP.NET is a thing and C# is another.

ASP.NET is a Microsoft web framework designed to enable developers to create web pages faster and more dynamically.

C# is a programming language, also developed by Microsoft, which can be used for various purposes, from games and desktop applications, to how to write applications for ASP.NET.

It is worth mentioning that ASP.NET also accepts Visual Basic as a language for scripting applications.

That one wikipedia article explain a little more (and more concisely) what I wrote in that reply.

16

C# is a language (+compiler).

It defines the syntax of the language (for/foreach loops, switch, class statement, Generics, etc.) and defines some native types (int, string, etc.).

.NET is a framework and a Runtime (for C# and VB.NET), a set of classes that helps in the development of any application: List<T>, Linq Extensions, etc, usually under the namespace System.*. There are some different versions of . NET specialized for some platforms: . NET for XNA, . NET for Windows Phone, . NET for Windows Store apps.

Winforms, ASP.NET, Winrt, WPF, WCF and everything, are other frameworks. Each helps in developing applications of a specific area. WPF adds type classes Label, TextBox, etc - while ASP.NET adds HttpContext, for example.

12

C# is the programming language. Like Javascript, Java, C, PHP, etc. It allows you to write code that will be, one way or another, executed by the computer. There is a specific syntax and semantics defined in specification and implemented in a compiler.

This language was created to be used on top of a specific platform called CLR, which is a virtual machine. It’s software that simulates a computer and has its own rules of operation. With it it is possible to control better what the software that runs on it does. It’s easier to port code to real physical platforms (other processors and computer architectures). With CLR it is easier to produce reliable and flexible code and more security is possible. Languages running on top of CLR compile to a common assembly language called CIL.

CLR normally runs on a framework called .NET, created by Microsoft. But it can run on other compatible ones, such as Mono, for example. Today there are several versions of. NET, each one with its peculiarity to better meet the needs of the developer and user of the end application (but is everything being unified in one thing only). Beyond the Runtime which controls the virtual machine, the garbage collector and other functions of the platform, there are libraries and subframeworks where you find the various algorithms and data structures used by C#. Some of these frameworks internal or accessories to . NET are quite complex and despite performing specific tasks, are quite large.

This framework cannot be confused with the programming language. Of course C# has been used to write most of it and it is necessary for the language to work, but they are different things, despite their interdependence.

Knowing what a framework it’s easier to understand what the ASP.NET. It is a set of codes that perform a specific task in an integrated way. He is responsible for manipulating web pages on .NET. There are classic ASP.NET variations (or Webforms) and the ASP.NET MVC which is more modern and currently preferred by most developers.

Other frameworks are used for other tasks, including access to desktop there are competitors within the . NET itself, such as the Winforms, WPF and Winrt, each with its own characteristic.

We have seen that ASP.NET is just a technology used in the ecosystem of the platform commonly called .NET. It cannot be confused as a programming language, as many do. It has no syntax of its own. Although both classic ASP.NET and ASP.NET MVC have classic syntax Engines rendering pages that have a code markup and embedding syntax, such as Razor.

ASP is a technology for creating web pages created by the existence of .NET. It should no longer be used for a number of reasons, but mainly because it does not have full support by the vendor, Microsoft.

It is often called classic ASP to not confuse with ASP.NET, since confusion is common.

Among the many limitations:

  • the ASP uses the Visual Basic ancient in scripts not compiled, pre-VB.NET and does not allow another language, as in . NET that allows, in thesis, any language supported in CLR
  • several improvements in error handling, events and other programming techniques, such as cache, are not available
  • the number of libraries available is much more limited and those that exist do not have the same quality
  • development methodology considered obsolete and difficult to maintain
  • there are conceptual problems, memory manipulation and session control

I strongly advise to accompany all links above and if possible see the English pages of Wikipedia that are better. From there continue following the links more relevant. There is much to learn.

Everything becomes kind of obsolete. We’re talking about outdated technologies, has a link above that shows the modern way of what must follow now.

  • the term classic ASP.Net would you like? Webform? ASP Classic 3.0 ? I thought this part got a little confusing.

  • You could say it’s Webforms.

1

Asp.Net or Active Server Pages . Net is the new version of ASP that serves the Microsoft Framework. however it is possible to program in Vb.net together with Asp.net. Not only C#.

C# is a programming language designed to "run" under the . net framework. The Framework also allows you to write VB.Net and F#, some older versions had up to J# .

ASP Net came to replace the obsolete ASP and came up along with Microsoft’s new proposal at the time that was the . Net framework

  • In Asp net you can also add label, textboxes and everything else, the only difference is that it will run on the WEB, (roughly) but there is the same facility to develop Desktop... with some particularities; There is a concept behind but that you go beyond, researching and studying about the area of WEB development

1

ASP.NET is a "template" (template) language that allows writing an HTML page with replacement directives that will be post-processed by generating a C# or VB.NET program depending on how it is configured. You could get the same result purely by writing in C# or VB.NET and using the directives to send HTML but ASP.NET makes this process easier because it provides this processor (from which you can easily get the file. Cs or . Vb when running the site).

C# is one of the programming languages supported by . Net framework, that’s all.

1

C# => Programming Language.

ASP ~> => Technology.

ASP.Net => Technology using the Framework . Net.

.Net => Framework.

1

ASP.NET is, briefly, a front-end for Web platform, in the same way that Windows Forms or WPF is also a front-end platform for desktop platform.

The language used in ASP.NET is for design only, while VB.NET or C# can be used as code-Behind.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.