开发者

semantic difference between ASP and C#?

开发者 https://www.devze.com 2023-02-11 10:47 出处:网络
Forgive me for my ignorance on this subject, but I\'m a relatively seasoned php programmer who\'s had no experience in any other Web programming languages, except some Ruby.

Forgive me for my ignorance on this subject, but I'm a relatively seasoned php programmer who's had no experience in any other Web programming languages, except some Ruby.

I've be开发者_如何转开发en told some time ago that ASP and ASP.NET are somewhat equivalent to PHP since they perform basically the same tasks,i.e. handle post and get requests, can print html, access a database, and so on.

So if they're similar and in PHP I can basically do everything I need for a web app, what is the need then for another language in the Microsoft Stack, namely C#??

If I'm not mistaken, C# is one of the most sought-after language here at SO, so I'm guessing I'm missing something big here.

Could I have some clarification? Thanks in advance


Ok, there are 3 layers involved here.

  1. C# <- This is a raw programming language. It can be used alone just like any other language. This would be roughly equivalent to PHP, Ruby, Perl, etc

  2. .NET <- This is a framework for natively interacting with libraries from any supported language. Without .NET, if you wanted to use a VB class in a C# application, you would need to build some kind of interface (such as a RPC via network, or a command-line wrapper, etc). With .NET, you can directly interact with a VB.NET class just how you would with other C# classes (and data, etc). Basically, it makes it easier to integrate multiple languages. There is no equivalent in PHP...

  3. ASP <- This is a framework for building web-based applications. Remember, C# and VB are (for lack of a better term) generic languages. There's nothing in-built to the language for dealing with websites. So ASP adds a layer ontop to make creating websites far easier (request handling, MVC libraries, etc). This is similar to the framework concept in PHP (such as Zend Framework).

Now, there are 2 versions of ASP. The old version (known as Classic ASP) and the new one (ASP.NET). The difference is that ASP.NET is built on top of the .NET framework. So using ASP.NET allows you to make web sites with your language of choice (as long as it has a .NET binding, such as C# or VB.NET, etc).

ASP.NET and .NET are nothing more than layers on top of an existing programming language (C# in this case, but many others are also supported). They are there to make your life easier. Everything they do can be done in straight C#, but the framework is there to abstract away the common themes and let you focus on your problem (like any good framework)...


ASP.NET is a web development framework that you can interface with using C#(or VB.NET).

C# is just a language that as implemented for .NET


PHP and asp/asp.net are similar in that aspect..but when it comes down to site implementation, they are very different.. In PHP, you can integrate php code with html, making it super easy to make dynamic web pages. asp.net on the other hand is basically MS's easy way to create html, and place and implement server side and client side script/code easily. You need to know C# or VB in order to implement .NET server side code.


Like Achilles said, ASP.NET is a framework that has a lot of fun features and so forth. It is not a language. You do not write things in .NET or ASP.NET. You write code using one of the .NET-friendly languages, such as C#.

As an example of the difference, you may choose to bypass .NET altogether and write your C# code against the Mono project, which is a .NET-like framework but not from Microsoft.

To further clarify, you may write aspx pages, but you will be using a combination of HTML and ASP.NET server controls, or as the case may be if using MVC, you will be using a combination of HTML and C# code on this aspx page.


I think you're confusing some things.

There is ASP - often refered to now as Classic ASP. This is a dynamic, PHP like, web language. PHP and Classic ASP are very similar.

There is ASP.Net, which relies on an underlying language like C# or Vb.net.

As for your question as to why choose one or the other:

PHP/Classic ASP vs. ASP.Net:

.NET & ASP vs PHP

http://www.beansoftware.com/ASP.NET-Tutorials/Classic-ASP-vs-ASP.NET.aspx


for writing asp.net page you need a language like C# or vb.net.

0

精彩评论

暂无评论...
验证码 换一张
取 消