"ASP.NET is a web application framework developed and marketed by Microsoft to allow programmers to build dynamic web sites, web applications and web services."<p>While other alternatives like PHP, PHP based frameworks (CI,Symfony,Zend), then Rails etc... really make the job easier when compared to asp.net.<p>While in PHP you would be writing 5 to the point lines to do something, in asp.net the same would need you to have things that are irrelevant to the goal, in the code...<p>have a look -
<%@ Page Language="C#" %><p><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><p><script runat="server"><p><pre><code> protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = DateTime.Now.ToLongDateString();
}
</code></pre>
</script><p><html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Sample page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
The current time is: <asp:Label runat="server" id="Label1" />
</div>
</form><p></body>
</html><p>Now how much of PHP would the same code require ?!
So, Why would anyone go for asp.net?<p>I understand that number of lines doesn't matter after reading some great comments, but don't you thing it slows down quick learning in some way... because you've to go through big chunks of code that do simple tasks... while on this front, other languages make learning really easy and fun with short straightforward codes.
Your comparison is overly simplistic and doesn't really prove anything. I'm a unix guy, so my exposure to ASP.NET, while existed, was limited. ASP.NET tries to make writing large apps be a manageable process, tries to use the existing .NET library and plugs well with other Microsoft technologies. I can't really argue on much deeper levels, but comparing how many lines of code some mundane task takes isn't really saying anything.<p>I can create my own DSL whose sole purpose in life is to send dates to a browser, and all it takes is a file with the character "x" in it; that doesn't make my language any better than Rails, ASP.NET, php or anything else. Different languages and platforms exist to solve different problems and cater to different markets.
Microsoft has done a lot of things wrong in terms of its various software offerings. Visual Studio is one of the things that they have done a pretty good job on though.<p>Asp.net is also very attractive to the legions of .Net developers who may not have much exposure to the web way. It mostly abstracts web interactions away, so that it's not a huge leap to go from client/server applications to web apps.<p>Sure, there is a lot of code in the final result, but the IDE helps automate a lot of that, and in combination with ReSharper, it's not a bad environment to work in.
> So, Why would anyone go for asp.net?<p>Because they have an existing investment in C# and/or the microsoft stack, and a team of developers who know C#/visual studio. In that situation it's pretty hard to sell PHP.
I've spent some time digging through the .NET internals (through books and code) and have/had a good familiarity with IIS and the HTTP pipeline Microsoft has set up.<p>ASP.NET is an oddball. It's roots, as many have pointed out, were to make web programming look like windows programming. That's the crappy part.<p>The good part is that there is a heckuva lot of power under the hood if you take the time to learn the mechanics of things. I can move from a drag-n-drop GUI programming of the web into all kinds of other things depending on my whims. I can go XAML, or Silverlight. I can go straight functional with F# or some of the other functional languages for .NET.<p>And it all runs inside the same IDE with IntelliSense and debugging and machine-level inspection if I want it. And all the applications, no matter what their language, can easily interoperate with each other. And if I stick to ASP.NET 1.1, I can run on *nix boxes all day long.<p>The list goes on.<p>Please don't misunderstand me. I don't have the religion, so I'm not trying to pump it up more than it is. It has real problems as an architecture because the winform idea doesn't fit into web programming. Having said that, however, a good programmer can crank out ASP.NET applications as fast as anybody else in any other platform. For exploratory web application programming it's on par with any other platform. The new team stuff looks pretty cool.<p>I find that most people who dis ASP.NET failed at learning it or are just blowing off steam. To say the same thing a different way, by the time you've wasted years figuring out where all the alligators are, you don't see what the big deal is any more.<p>Biggest plus? I can almost go to Seven-Eleven and pick up good ASP.NET programmers. The market has a lot of them (cheap). Biggest minus? Just because a bunch of stuff is hidden doesn't mean it goes away! Great ASP.NET programmers can crank out Javascript, CGI, and StoredProc code with the best of them. By "helping", Microsoft makes it a real pain to get under the hood and take total control (but it's very possible to do once you get the hang of it)<p>BTW, your example? You drag a label onto the form, double-click on it and type one line of code in. I'd argue that it only takes one line of code (and about 5 seconds) to accomplish. The rest is framework fluff.
> So, Why would anyone go for asp.net?<p>The .NET development environment.<p>Visual Studio is dead simple to install and use. Add-ins have been easy to install, too. (I'm looking at you, Eclipse!) The .NET Framework has great breadth and depth. It integrates well with MS SQL Server. There are plenty of quality 3rd party tools/libraries that work with the stack. API documentation is easy to get to. Building install packages is a snap. Visual designers can make building/understanding components or the database schema easier. Code generation from the designers can fill in boiler-plate stuff yet still leave it visible if you need to dig around in there by hand.<p>As for ASP.NET WebForms (which is the sample you've given), it was meant to make it easier for Windows Forms developers to do web page design. WebForms imitates the WinForms structure and calling conventions, so you can make a working web page act more like a desktop app in terms of the programming model. Obviously, you run into limitations rather quickly because the WebForms abstraction is very leaky.<p>ASP.NET MVC would be a good pick for new projects if you are already an experienced web developer. You get all the benefits of the .NET stack without the limitations of WebForms. You get control over the markup that gets generated and it does a good job with separation of concerns. I recommend.
ASP.NET isn't the worst technology to use for a startup. There's lots of useful prebuilt components for it (commercial usually, but the value is still there).<p>Microsoft is also offering some pretty good hosting platforms for startups, and usually you can pick up licenses for low cost. EC2 now is also offering Windows instances for easy cloud hosting.<p>That said, I've done ASP.NET professionally for about 5 years, and 2 years ago switched to Ruby / Rails / Merb and have found the transition to be a huge improvement. The open source world has a better atmosphere, and I believe better talent overall.<p>The worst thing about ASP.NET is the corporate culture, where unskilled VB coders adopt it, and use it to build really badly developed websites.<p>Also, ASP.NET pretty much requires Windows. Trying to develop it on Mono, or on a Mac (with Vmware) is an effort in futility. If you go ASP.NET, make sure you're comfortable with Windows. This was one issue that I had a major problem with. Command line scripting and build tools in Windows are generally aweful. This will limit any good developer's productivity.
Because sometimes you don't have a choice. Either by policy or by inheritance, you might be stuck with that environment.<p>In my day job, i use ASP.Net MVC framework because we're an all Microsoft shop. And although i recognize the danger of proprietary systems in the medical field, I am unable to change anything at this time.<p>Also i find that Microsoft products work best with other Microsoft products so SQL Server with Windows Server 2003 and ASP.Net along with Active Directory and so on...<p>But, echo'ing the other comments, using a limited metric such as number of lines to implement a feature is a bad idea. Try it out on some application and then you'd be better equipped to dismiss or recommend it.
Because C# is a <i>very</i> good language.<p>How many security holes have been found in the asp.net stack vs the php stack? I recall seeing a php security issue on reddit or news.y about once a month (anecdotal of course). But you don't have those problems with asp.net.<p>Yes php provides simplicity in the language but complexity in the configuration. You have to be pretty handy with *nix to get it all working right. Remember facebook showing all it's code to the world?<p>Asp.net windows configuration can be easier especially if you have a windows background.<p>In the end though, if you know php use that. If you know python use that.
- Huge library of high quality components<p>- One of the best available development environments (Visual Studio)<p>- C# is much better for structuring your code base for large teams and long lived projects<p>- If you're really using a database, SQL Server is way, way better than mysql.<p>I prefer Rails myself, but I manage a team who prefers .Net, and I can see the advantages.<p>I agree with other posters, Webforms are horrible and wrong, but MVC could make .Net one of the best Web dev platforms.
In my experience (and I'll preface this by saying that I'm not quite an expert yet) ASP.NET is fairly easy to bring people with no web experience up to speed. Our development company switched from LAMP to ASP.NET, C#, and MS SQL Server. While I wasn't involved in the decision-making process, I did ask them why they switched as I came from a LAMP background. They said that their company gets all of their employees from their internship program, and it was easier to train interns with all of the standardized tools that Microsoft puts out. Plus there is a pretty good community of .Net developers that makes the training process easy. It took me far longer to learn PHP than it did to learn C#, but maybe that's because my coding experience is better now than it was then. :)
As far as I remember it took me considerable amount of time to get along with C# alone, but after that playing around with ASP was much more easier. If you're planning to start asp.net or other microsoft stuff like .net, make sure your OOP fundas are thorough.
I'm not a big ASP.NET fan, but the number of lines of code to do something is less of a concern to me than the underlying hardware requirements and licensing costs to produce a running application.
I support many internal ASP.NET apps at Intel because our internal employee services applications started as classic asp/com on oracle db over 13 years ago. ASP.NET is really great if designed/written properly. Like others have said, once you are a .NET shop it's easy to find .NET talent. I'm currently working on our LMS which is Java/JBoss and I've learned to respect .NET, Java, LAMP, Rails and Python. I have web.py and django on my todo list for building some fun personal apps. Hope this helps give you perspective.
You know guys! Thanks a lot, I love HN for it helps me broaden my scope of thinking :)<p>Its logical to build upon framework already tested and tried, so coming up with something new would've been a waste of time n resources, whereas the current .net scenario provides nice integration as i notice..<p>another point that comes to my mind is that -- Things couldn't be kept more simpler than that, as you can't sell simplicity at high price.