ASP .NET and C# - c#

I am fresh out of college (passed in 07) and have been working on a Windows Forms project since then.
I have a decent understanding of C# (not all the features of the language only the ones that i got to use in the project) and am very interested in learning ASP .NET
Would it be better to start learning ASP .NET and pick up C# as i go along or do i first master the language and then start with ASP .NET
EDIT: I am talking about the 3.5 version of the .NET framework

You're conflating some terminology. C# is a language. ASP.NET is a way to use a language (typically, C# or VB.NET) to create web-pages. So if your two interests are C# and ASP.NET....
Do ASP.NET in C#.

You can quite easily pickup C# and ASP.Net at the same time. You might want to consider learning ASP.Net MVC, as well as/instead of "normal" ASP.Net.

I was a straight VB6 developer when I started transitioning to VB.Net. I'd only done desktop applications - not a single thing in the web world. I started learning ASP.Net (job required it) and decided, at the same time, to switch to C#.
Re-did a couple of small applications that I'd previously written in VB6 and VB.Net in C# and just went on from there.

I agree with most of the people here: Learn ASP.NET and C# at the same time. You'll have to - your code-behinds will be either VB.NET or C# anyway. Also check out MVC, and LINQ.
But, and here's the big thing, learn standards compliant HTML too! Most of the drag and drop controls in visual studio do horrible horrible things to HTML (gridview, I'm looking at you). If you follow proper HTML standards you'll also use learn what controls are more useful (repeater) than others when developing clean websites.

You should be fine to learn C# while working on an ASP.NET project. I will advise that if you're already pretty familiar with the Web, you'll probably find working with the ASP.NET MVC framework more enjoyable. ASP.NET takes some liberties with the page lifecycle in an attempt to make web pages programmed more like desktop applications. Personally, I think this makes ASP.NET hard to use, but then my background is in Perl and PHP.

When I learned asp.net and C# I learned them at the same time but separately. I got a good book about ASP.net with C# and I also got a book just about C#. I found that helped. It sounds like you already use C# so it shouldn't be a problem for you.
As others mentioned, another thing to consider is asp.net webforms vs asp.net MVC. If your background is winforms then webforms will make sense. If your background is php or a non event driven framework then MVC will probably make more sense.
MVC is the 'hot' new thing everyone is talking about with asp.net these days. However, realistically there are a lot more resources, tutorials and code samples for webforms. I'm sure that will change as MVC comes out of beta and gets used more.

As far as I'm concerned, the only true way to learn is by doing. Hit the official ASP.Net site and download the tutorials and working through them.
Remember ASP.Net is NOT a language but a way of hooking up HTML to your C#/VB.Net code. Have fun!

Since you already have some experience in C#, I would recommend that you dive right into an ASP.NET project. ASP.NET will present learning opportunities on the web side of things although webforms abstracts out much (maybe too much) of how the web works. Moving from winforms to webforms will help you be able to just jump right in but you will eventually want to look into MVC or another web framework (maybe PHP or even classic ASP).

Related

C# vs ASP in developing a web application

I have a coursework which requires me to do the following :
Make a website which can retrieve data from application db
Create three data repositories (two as application db and one as data warehouse)
Ensure that the two application db can sync their data with the data warehouse
I have intermediate knowledge in Java programming but I am thinking that I would like to try developing this in another language. Here is what I was planning to use (and also my confusion)
I am planning to use IIS to host the databases on multiple computers and I decided to use ASP.NET as my programming language for website and C# as its backend but I am confused about the relationship between ASP/ASP.NET and C#. It seems to me that having ASP/ASP.NET/ASP.NET-MVC is sufficient to build the whole thing without needing C#. Can someone please explain the differences to me? I am still at lost after reading about them the whole morning.
Well,
The difference are lot. Please learn this below links.
ASP is a old version
ASP.NET is advanced version than ASP
ASP.NET MVC is more advanced version than ASP.NET
You can click the above link for a difference.
also see this below discussion for
Relationship between C#, .NET, ASP, ASP.NET etc
the answer have:
I understand your confusion, believe me I have the same perspective when it comes to the Java world! Anyway I'll attempt to break your questions down and tackle them one by one... as well as add some other points in that will hopefully help clarify what's going on:
C# and C#.NET are the same thing... C#
.NET is, as you say, a library of code that .NET languages can talk to.
.NET languages come in different flavours such as: C#.NET, VB.NET, Managed C++, F#.
.NET languages compile to CIL (Common Intermediate Language) which means they all start "talking" the same language and can therefore interoperate.
ASP.NET is the portion of the .NET library used for making web sites. There are other subsections of ASP.NET like WebForms (the old way of making web pages) or the rapidly maturing MVC library that are worth looking at too.
Forms (old tech) or the new WPF (Windows Presentation Foundation) are the technologies you'd typically use in .NET to create what you know as traditional desktop applications.
One final thing I'd like to finish on is the difference between library and framework. In recent years these two terms have been used as those synonymous, however that is not the case. The easiest way I can think to differentiate the two is:
A library contains many pieces of functionality that you may pick and choose from i.e. using one piece of technology doesn't mean you're locked into the rest. This means freedom, however you will have more work cut out for you.
A framework however very much sets out how you will be working be providing a workflow that for better or worse is hard to change. This means rapid development/prototyping, but if significant changes are made in the future it may be impossible (or very time consuming) to implement them.
The project you're working on will depend on which choice you make.

Confusion moving to ASP.Net from Classic ASP

Probably sounds a bit stupid but I'm getting confused moving from Classic ASP to ASP.net.
After looking at the two different variants of the language, VB or C#, I have decided to go with C#. I was reading another StackOverflow answer that explained moving from VBScript to C# was easier to learn coming from VBScript.
So, I thought I'd hit W3schools to learn some basics on C# but got confused when I was given the options; Web Pages, MVC or Web Forms. Would somebody please explain the differences and which one would suit me best?
I have been coding in classic ASP/VBScript for many years, building all kinds of web application, some big, some small, and I do not want to use any software like Visual Studio, I just want to write code. I currently use Dreamweaver just for coding.
For a move from classic ASP to a .NET web platform, I would suggest going with ASP.NET/MVC.
WebForms are an abstraction that was created to make VB6 programmers comfortable with working on the web and it is a very leaky abstraction. It uses an event model and an idea of PostBacks that simply is not part of how the web really works. It has limitations that will not be familiar or make much sense at first (you can only have one form on a page, for example). As such MVC will be much more familiar.
I suggest that you watch this video by asp.net official developers as well as other relevant videos at the migrating section
Here's another good video produced to help programmers to choose the programming model (webforms, webpages or mvc, tools, etc)
Although w3schools has several good examples, it has several inconsistencies as well as incorrect information. Good alternatives for w3schools include MDN and IE Reference API (as the name implies, it's aimed to IE, and it's a good reference for when something works in other browsers but not in IE)

ASP.NET: C# or JScript?

I love JavaScript. I started out coding in ActionScript and since the syntax is almost identical, I naturally understood JavaScript.
Recently, I have been learning how to use ASP.NET and MVC (which is not new to me since there are several MVC frameworks for Flash and Flex). And I'm trying to decide whether I want to learn C# or JScript... I say this ignorantly because I don't know how different JavaScript and JScript are... and C# is a completely different language all together.
What advantages does C# have over JScript?
and does it really even matter that I know and love JavaScript?
C# if only because you will be a gazillion times more employable.
If you're using ASP.NET MVC you're going to want to learn both C# and Javascript. Microsoft is now bundling jQuery, a Javascript framework, with Visual Studio and it is a great fit with ASP.NET MVC. I'd recommend using C# for the controllers and model layers, regular HTML for the view templates and then jQuery for all the client-side DOM manipulation.
Edit: Just noticed you said you already know and love Javascript. I'd just like to point out that I had never used Javascript before learning ASP.NET MVC and I found it to be a lot more similar to C# than I was expecting. Of course C# is statically typed, however the syntax has quite a few similarities.
.NET in general and ASP.NET can be written in many languages, however only two are really popular and have big pool of support and tutorials: C# and VB.NET
This alone is reason enough to choose C# over JScript IMO, and C# share lots of its syntax with JScript - surely much more than VB.NET will ever share.
So like everyone already said, go with C# and you'll be swimming in familiar water with the bonus of many lifeguards available for you and ready to jump and save you when you drown. :)
JScript is actually a script language used by Microsoft product. If you compare JScript over C#, it's somehow like you compare JavaScript with Java.
ASP.Net require full managed programming language like VB.Net or C# (I noticed that the role of Java.net is fading out, is it?), I don't think JScript is supported in most cases.
One more PLUS on C#: Learning C# isn't that hard suppose you have enough experience in OOP ActionScript. They share quite a number of common syntax, and quite importantly, most tutorials and resources out there about .Net is written in C#.

My first .net web app - should I go straight to MVC framework (c.f. ASP.net)

I'm done some WinForms work in C# but now moving to have to develop a web application front end in .NET (C#). I have experience developing web apps in Ruby on Rails (& a little with Java with JSP pages & struts mvc).
Should I jump straight to MVC framework? (as opposed to going ASP.net) That is from the point of view of future direction for Microsoft & as well ease in ramping up from myself.
Or if you like, given my experience to date, what would the pros/cons for me re MVC versus ASP.net?
thanks
Have look here it will help you Choosing the Right Programming Model
If you need to work really close to the wire then MVC is a great choice. By this I mean, if you need to have very tight controls over markup then; while acheivable with WebForms; it is much easier with MVC. This would be common for applications that are targeting a public (e.g. internet) audience which might have a richer graphical experience. In contrast, if you're developing an internal (e.g. intranet) business application where graphical presentation is not as critical, then WebForms has a lot of really nice enabling capabilities that will allow you to move more quickly.
Don't get me wrong, you can make WebForm applications look really really nice, but you give up some control over the markup.
Very often ViewState comes into this kind of discussion. MVC will not have any ViewState so the on-the-wire footprint will be much smaller which translates to speed and bandwidth cost savings at some point. On the downside, making stateful applications with MVC can be more painful. In contrast, WebForms will carry ViewState by default and are inherently more stateful. This is typically fine for internal applications. Keep in mind that ViewState does not have to be sent over the wire... there are extensions that allow you to offload that to a local cache. I'm not favoring one over the other, but you should be aware of what each can do in this regard.
If unit testing is important to you then MVC is also a much better choice, as this is easier as well. This is totally acheivable in WebForms but requires you pattern your code behind correctly.
Security is not a major factor since much of setting up the IPrinciple and IIdentity occure in the HTTP pipeline via HttpModules, so either will do in that regard.
Another major factor in making your choice relates to your skills relative to the time you have to deliver... If you're not used to working in a stateless manner or coding standard web technologies (e.g. html, css, jquery, etc...) MVC will take you longer to do very basic things. With that said, once in place it will likely be cleaner, smaller, more testable, and faster. If you need to move very quickly there is a lot you can do faster in WebForms. WebForms also does a lot of heavy lifting with respect to markup so there are a number of details you can leave to ASP.NET.
I actually use both for a variety of reasons, and MS has stated they plan to continue support and development for both.
MVC is part of ASP.NET. You must mean MVC vs Webform to which the answer would be: coming from a Winform background, you will find webform easier to use. For the future, go MVC.
I used to work on desktop applications too, and never really got into web stuff. I didnt even (gasp!) knew HTML (yeah, that was my programmers shame). In my new job we were going to start a new application using ASP.NET MVC and I gotta tell you, I love it. HOWEVER I think you should only go with MVC if you are or you count with someone with good html/css design skills.
Html is easy I know (I've learned it know!) but I think its kind of hard to make nice designs with html and css, specially if you suck at designing and you could probably do prettier stuff using webforms, which is a little bit easier/similar to winforms.
Also, if you go the MVC way make sure you have enough time to learn it, since you are going to go a little bit more low level, gonna have to learn more of the little details, like the actual difference between post/get and all that stuff that is pretty much completely hidden in webforms. I would really recommend getting a book, I used this one Pro Asp.net MVC and really liked it.
Finally, if your page is gonna have interactive bits, or ajax-y things, if you go the MVC way you are more likely gonna have to learn javascript/jQuery too. If you go the webforms you can use the included drag'n drop ajax controls.
Coming from Ruby on Rails or other MVC based frameworks ASP.NET MVC is almost the best choice. (ASP.NET MVC is actually only the "VC" part, so you have to add an ORM of your choice. EF and Linq to Sql is the Microsoft way, NHibernate or other ORM's are the other way. One good quick start project is S#arp Architecture which uses NHibernate as the "M" part, or you can check out WHCM, which is a project built on S#arp Architecture and other good frameworks (it is considered an ASP.NET MVC best-practices demo project) ). ASP.NET MVC uses almost nothing from the WebForms package (the only exception I found is the AntiForgeryToken), so you'll loose nothing if you're unfamiliar with ASP.NET WebForms.
But as you said you have also made console applications, which ASP.NET WebForms resemble more.
If your project is new, I advise you to use ASP.NET MVC. If your project clearly separates the M-V-C part (like in S#arp Architecture, where they reside in different assemblies), creating a console application that uses the same business logic shouldn't be too hard. If your current project is to port a WinForms application to the web, then it might be easier to use WebForms.
I should get familiar with the language before using "fancy" stuff like MVC, because it's just way easier to learn when you could almost think in the language (but it's not necessary).
Horses for courses. If you're slapping together a quick app for someone, web forms is probably quicker and easier.
If you're building a long running enterprise app MVC gives you better testability a SoC.

Lightweight .NET web development?

I'm currently working on a project that has a sizable amount of both client and web code. The client code is written in C# and the web piece is written in PHP. Maintaining consistency between the two worlds is becoming cumbersome, and I want to consolidate the web code to .Net.
The issue is that I hate web development in ASP.Net Web Forms. I want something as raw as PHP, just using C# instead. I've read a little about ASP.Net MVC, but it looks like it abstracts too much of the request logic for my liking.
Does anyone know of a lightweight way to allow C# + .Net to handle web requests? Should I be looking more closely at MVC?
Update: I went with ASP.Net MVC and I've been very pleased so far.
If you're looking to get away from ASP.NET Web Forms, the I recommend ASP.NET MVC with a custom view engine (like Spark, or NHaml). This will give you the consolidation your looking for and allow you to avoid most of the Web Forms that your not happy with.
AFAIK, to do .NET web development, you are going to have to interact with ASP.NET in some form or another, but the custom view engines in MVC could be exactly the abstraction your looking for.
It is now possible to use a software stack completely separate to IIS and ASP.Net using Kyak, Nancy and Gate.
http://bvanderveen.com/a/gate-0.1.0/
You might want to check out Kayak, which is, to my knowledge, the only standalone .NET web development framework that's not ASP.NET.
Caveat: Kayak's request handling implementation is not the best, so there may be performance or scaling issues. I can't say for sure -- I've only read it, not run it.
Edit: I've taken another look at the source code, and it looks like they've rewritten a significant portion of their server code, and in doing so fixed the major issues. Performance probably won't be a problem.
MVC.NET is open source, so you can make it do what you want. It is a framework that is overrideable, extensible, etc. I'd look closer at it. It works great for me and I've come from a background of CGI, Struts and Webwork. I love it.
In my opinion nothing is more lightweight than the combination of NancyFX (http://nancyfx.org/) with Dapper (https://github.com/SamSaffron/dapper-dot-net) for data access.
NancyFX can be hosted within ASP.NET, WCF, Azure, OWIN-compatible environments, Umbraco or you can write your own host.
Read also these articles:
http://theothersideofcode.com/lightweight-development-in-dot-net-nancy
http://theothersideofcode.com/lightweight-data-access-in-dot-net-massive
I also suggest you to TinyIoC (https://github.com/grumpydev/TinyIoC) for decouple your application layers.
Regards,
Giacomo
You should look into the IHttpHandler and IHttpModule interfaces. These are the foundations for ASP.NET WebForms. Brad Wilson has a good intro to the former.
In the bad days when WebForms was the way to do ASP.NET development I was writing my own simple MVC framework with these interfaces. The bit I struggled with at the time was the View engine but now there are a number of these.
You take a closer look at ASP.NET MVC since the source is available and decide for yourself. It may be that you want to change some of the conventions used rather than the whole framework.

Categories