Code Syntax of ASP.Net - asp.net

I have learned VB.Net with the help of some books and blogs like code project but I donot know even the basics of ASP.Net that I really want to learn.
Could you please advise me if there is any difference between the code syntax of vb.net and ASP.net or I can use the same syntax to build asp.net applications?
Thanks for your help.

If you're writing your ASP.NET server-side code in VB, then it's standard VB.NET code just like you're accustomed to. The two most popular languages for .NET are VB and C#, and you can use whichever you wish. But the fact that you're using ASP.NET doesn't change the syntax or structure of either one of them.
Basically, ASP.NET is a web framework that you'd be using to build web applications written in your language of choice (in this case, VB.NET). You'll want to know more about the framework, such as how to design your forms and make use of the web controls (and knowing HTML/CSS/JavaScript is a big help too). But the overall syntax of the VB code doesn't change.

asp.net is not a language it is a framework.
vb.net is a language which used alongside asp.net to build websites/web applications.
So in a way yes there is a difference, but the difference is that they are two different things.

It's worth noting that VS provides a somewhat watered-down interface when using VB as opposed to C#. It's really worth your time to get familiar with C#.
Microsoft's ASP.NET hub hub is a very comprehensive resource for tutorials. I'd recommend starting there, and coming back here when you have a specific question.

ASP.NET is the technology, and you can choose which language you want to use with it. C# is the most widely used Microsoft languages, but you can develop ASP.NET applications in VB.NET too.
Use VB.NET to fimiliarize yourself with ASP.NET and get a handle on how it works. Eventually, it would be a good idea to learn C#, because it's the most widely used snytax in the world. Most modern languages are rooted in the C syntax, so by learning one of them you're learning all of them. It really is the biggest bang for your buck in terms of applicable experience.

Related

Can MVC do something Web Forms can't? (asp.net)

I'm sort of new to asp.net. I know both MVC and Web Forms have their advantages and disadvantages, but I'm more familiar with Web Forms so I've only used that.
I was just wondering if there's something MVC can do that Web Forms can't?
From what I've understood, it's basically just different ways to code but you can get the same results from either.
This may have already been answered but I can't seem to find something that's only doable by MVC or only by Web Forms.
Thanks.
Asking "Can MVC do something that Webforms can't" is like asking "can you store papers in a well organized filing cabinet that you couldn't in a pile on your desk?" The answer, really, is no. The difference between MVC and Webforms is not functionality, it's ease of development, ease of maintainance and scalability. There are problems that webforms handles more naturally (very few IMHO, but they exist) and problems that MVC handles more naturally.
As an additional point, your question could actually be applied to any two frameworks or languages (assuming that some component of the framework is Turing Complete). Not only could you do anything in Webforms in MVC and visa versa, but you could implement the entire functionality of either in C, or R, or COBOL, or TSQL. Choosing a programming tool is about what it can do but what it does easily.
Web forms do everything which can MVC. Its just matter of maintainability, testing, separation between layers etc.
See Java can do everything which can C# , but C# have some more features then Java which make programmer's life easy .
Mostly programmer use new Design Patterns due to their advance features like AngularJs now replacing Jquery due to its advance features like Declarative Way, Directive, Routes, Two way binding. Jquery can also do everything which AngularJs can. But AngularJs more robust then jquery in terms of performance, testing, maintainability, separation of concerns.

Moving from WebForms to ASP.NET MVC

i know ASP.NET and i would like to learn and make a new project in ASP.NET MVC.
Is it easy to move from asp.net to asp.net mvc? Will the knowledge i have so far be helpful?
Im asking because i will have only few days to learn asp.net mvc and i want to know whether it's possible...
Cheers
I think you will find this questions (and its answers) very helpful.
Is it easy to move from asp.net to
asp.net mvc?
My answer to this would be a question back to you. Do you understand HTTP? Is web forms sort of magical to you, or do you have a firm grasp of what the abstraction is doing?
The reason I ask is that MVC sort of strips away a lot of the "magic" that web forms gives you in terms of treating a stateless protocol as actually having state. I tend to think of out of the box web forms development closer to classic windows forms development then normal web development. There are good and bad things about that.
What MVC is doing is bringing closer to what is actually happening in HTTP and in the end giving you more control and power over that. What you won't find in MVC is slew of drag and drop datagrid type controls, but it will make it easier to write AJAX heavy sites with common javascript libraries and clean html, as well as enable you to more easily write testable code.
Will the knowledge i have so far be helpful?
Without knowing what your "knowledge" is, it is hard to say. Obviously c# and vb are the same it's not like its a new language.
It really comes down to what type of web developer you were in asp.net forms. If you found yourself annoyed at how IDs were generated and how the html output of controls was horrible and that the framework was making it hard to do what you want then you should be fine.
If you were like I stated before, more of a drag and drop type of web forms person than MVC might be a bit challenging, but I would say its a good challenge and something that will ultimately make you a better web developer.
The only way you'll really know is if you try... There are tons of resources out there to get you started.
Hope that helps. Don't be afraid to ask questions on here as you go, there are tons of MVC devs on this site.
If you've ever used technologies like ASP classic, Coldfusion, PHP, etc. where you intersperse regular markup with server-side logic, then you will be able to pick up the "view" syntax pretty easily. The controllers are pretty simple to grasp once you get the hang of it, and the model shouldn't have to change from what you are used to. The hardest part for me to grasp when first learning ASP.NET MVC was the routing.
Like anything else, it will take some effort before you learn the "right" ways to do certain things, and you will initially be a bit less productive in the new technology. But in the end it is worth it.
Personally, I felt that ASP.NET MVC was far easier to learn than ASP.NET WebForms.
Run through the NerdDinner tutorial. It should take you about half-a-day. I think you'll find the simplicity refreshing.

Usefulness of asp.net MVC framework as opposed to coding MVC style with regular asp.net?

I am new to the asp.net world (but not new to .net) and I have been playing around with various things to see how I want to architect a web application I am developing. In my playing around I have decided I did not want to use asp.net's controls, as I have done enough php and ruby on rails to be decently familiar with regular HTML, and a decent amount of javascript.
I see a lot of comparisons between asp.net webforms and asp.net MVC, however when ti comes down to it I am not seeing that much of a difference (and I'll admit that it's probably me missing the differences rather than them not being there). I already have coded my asp.net application using a MVC type of architecture (aspx has the view, aspx.cs has the controller code, and models are separate classes in the app_code directory).
If I do not intend to use asp.net controls and just intend to use pure html and javascript, what are the advantages of using the MVC framework? As of right now, the only one that I am seeing is routing, and I'm sure if I look more I can find easy ways to do custom routing without using the whole MVC framework.
Anyways, if anyone could go into details of asp.net webforms minus the asp controls versus mvc framework, I would be greatly appreciated.
You're going to find a number of differences and reasons to use MVC over WebForms but it's going to depend on whether those differences are important to you or your project. Routing is definitely a big advantage for MVC. Although you can implement custom routing configurations in WebForms it's significantly less intuitive.
Another big advantage is unit testing. Along with an IoC container and a mocking framework, MVC makes unit testing a cinch. It's much easier to isolate actions and behaviors with MVC and test those specifically.
A third advantage is that MVC will help reduce the spaghetti code you're going to write. If you're not planning on using any User Controls then it won't be long before you're missing the HTML helpers in MVC. The Html, Url, ViewModel, TempData, etc make working with raw HTML much easier.
The inherent validation in MVC is also impressive. It's getting better in MVC2 and now with the integration with client side validation libraries it will save you a ton of time and add a lot of functionality.
No more VIEWSTATE.
There are many others but again it depends on whether those features are important to you. Good luck with your decision!
ASP.NET MVC is built on interfaces, which makes it extensible, easy to write unit tests for, and encourages clean, loosely-coupled architecture.
If you're using 'classic' ASP.Net without using any of the server-side controls, there's not much of ASP.Net that you're using -- it's basically classic ASP with .Net instead of VBScript behind it at that point.
Giving up webcontrols is the biggest reason not to use ASP.Net MVC. If you're fine giving that up, I'd just use ASP.Net MVC and be done with it. It's got all the parts you'd need to write yourself anyway, and the parts you don't like, you don't have to use.
In my playing around I have decided I
did not want to use asp.net's
controls, as I have done enough php
and ruby on rails to be decently
familiar with regular HTML
Thats not a good reason to decide against ASP.NET controlls. The importand thing about ASP.NET is Viewstate. It allows you to use event driven programming in Webapplications. This makes a lot of things very easy and productive.
Anyway - as you know ruby on rails I guess you will pick up ASP.NET MVC pretty fast.
First up, if you use ASP.NET MVC you'll be using a supported framework that has books, online resources and hundreds of blog posts surrounding it.
Second, I suspect you need to play with ASP.NET MVC to see it's power. There is way more than WebForms in ASP.NET MVC. For many, the fact that WebForms is optional (you can use different view engines) is a major plus.
For me, the extension points, the cleaner code, and the unit-testability of everything I do are major reasons to never go back to ASP.NET "classic".
My recommendation to you is to get a decent tutorial (look for the Nerd Dinner tutorial), play with ASP.NET MVC, and find out for yourself.
Note: ASP.NET MVC is not for everyone, and if you're heavily into the post-back mechanisms in ASP.NET, or have a heavy investment in server and user controls, then you might not want to take ASP.NET MVC right now. But for your next project you should at least know what your options are.

Do I need to learn c# beforestarting to work with asp.net

Just wondering if I needed to know c# before I can start working with asp.net,
can I learn them together?
what is a good starting point like a book or online tutorials.
thanks
Personally I'd start by learning C# without ASP.NET, preferrably via console applications. That way you can get to grips with the language and the core types (collections, I/O, text, primitives etc) without being hampered by all the extra stuff ASP.NET throws in your way.
There are various oddities in any "peripheral" technology (ASP.NET, WCF, WPF, WinForms etc) that it can be very confusing if you don't know the core stuff well: if something goes wrong, you can easily end up not having the faintest idea where to start finding the problem. Is it a misunderstanding about the language? The collections? The way that ASP.NET events are autowired? I'm sure you see what I mean :)
C# 3.0 in a Nutshell is a good book in terms of covering the language and the core framework. Then get a good ASP.NET book separately.
ASP.NET is a web framework - in other words it is simply a set of libraries that make creating websites easier by abstracting away all the tedious details. In order to write code to harness this framework you will need to use one of Microsoft's .NET languages (C#, VB.NET, etc.).
you can also use vb.net (visual basic). Might be beneficial if you are already familiar with it
I think you can start learning asp.net before C#. But you'll really benefit from doing both together.
http://www.learnvisualstudio.net has loads of great video-tutorials (ASP.NET, VB.NET and C#).
Yes, you can learn them both at the same time, it is often easier to start if you know C# or VB beforehand, but not a requirement at all to be successful.
There are many places to start, but 4GuysFromRolla.com is a great tutorial site. Otherwise, any of the beginning ASP.NET books would be a good starting point from a book.
C# in my opinion is the easiest of the languages supported by the Dot Net framework. I would suggest starting there.
ASP.NET leverages the multi-language capabilities of the .NET Common Language Runtime, allowing web pages to be coded in VB.NET, C#, J#, Delphi.NET, Chrome etc. This means you don't have to learn C# to use it and, even if you don't know any of those languages, you may find it easier to start with a more human readable one such as VB.NET.
In any case, I recommend the following tutorials if you do plan on learning C#:
http://msdn.microsoft.com/en-us/library/aa288436%28VS.71%29.aspx

Should new programmers learn ASP first or ASP.Net? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
My colleague here argues that new programmers must learn ASP first, before they learn ASP.Net.
I seem to agree with him as most new programmers who start with ASP.Net do not understand web get, post and state management :(
Which is best to learn web programming Classic ASP or ASP.Net?
I'd pick ASP.NET MVC over classic ASP. The problem with classic ASP is the support level for it. With MVC, you learn both about web get/post and state management, while at the same time getting the advantage of using your favorite OO language.
I would say don't learn classic ASP and then ASP.NET. Classic ASP is dead. Or should be.
Why not learn ASP.NET (MVC and WebForms) while also dabbling in PHP. Looking at PHP would help a developer get a sense of what its like working at a lower abstraction level.
I'd say most new web developers would be better off initially learning about HTTP specifically without muddying things with either classic ASP or ASP.NET.
Once they have the fundamentals, then I'd suggest moving straight to ASP.NET and a compiled/object oriented coding language.
While classic ASP is more compact and focused (smaller group of objects to grasp), most code written using it is unfortunately in VB-Script.
Some of the most atrocious code I've ever seen was classic ASP web sites in VB-script. While it is probably possible to write maintainable and clear code in VB-Script, the language itself seems to almost encourage the complete opposite.
Also, it sounds like ASP.NET MVC would be a better choice for your environment as it "hides" less about HTTP from the developer. For certain types of application it is a better choice then ASP.NET Web Forms.
In summary: skip the classic ASP and avoid all of the bad habits and problems that it can introduce.
It wouldn't hurt to start with Classic ASP, but I don't think it would be worth it since with a little effort you can understand what Webforms is abstracting away from you. If you want the best of both worlds, start with ASP.NET MVC.
It's the equivalent argument of saying something like:
"You must learn pascal before you learn C++!"
You're comparing 2 different languages & platforms.
I agree with others here that learning the HTTP request/response model is the key. I have also noticed that many .NET developers don't understand the HTTP model. I learned it using ASP, but .NET WebForms makes it easy for developers to not need to know it. So I agree that ASP.NET MVC would a great way to do both .NET and learn the HTTP model.
There is very little value in starting out with ASP. If you were an ASP programmer back in the day then you can appreciate some of the concepts that have carried on into ASP.NET. The fact that IIS 7 and newer versions of Visual Studio are not really that ASP friendly means that learning it as a new programmer is really more hassle than its worth. Start with what's current is what I say because its what everyone's doing.
Also, be solution oriented - language should be secondary. At the end of the day you need to deliver something that works which makes the customer happy.
Both languages have their individual advantages.Though, I agree with reply by 'Haacked' and 'John Sheehan' both. Every one will have their individual opinions. So better start learning in which you are interested.
I think you need to be thinking far further than state management and instead be thinking of the other implications of imposing learning classic asp first.
Rather than learning classic ASP, instead ensure your developers have "state management" as part of their training process. All good training material will include a state management section.
You may run the risk of thinking in the classic ASP paradigm and attempting to apply a defunt design pattern to ASP.net. Instead of making best use of ASP.net's platform and technology.
Having said that I have been developing in ASP.net for a number of years. I am currently maintaining enterprise grade classic ASP systems. Having the knowledge of how the frameworks behind these systems were developed pre-ASP.net is very valuable and HAS improved my ASP.net.
Learning an alternative language is always valuable: Recently I developed an iPhone app in objective-C, it has given me a better understanding of the MVC pattern (the defualt paradigm in XCode) - so will improve my ASP.net in the long run.
Although looking at enterprise systems will be valuable, I do not think just dabbling in classic ASP (i.e. small one-off pages) for the purpose of state management etc is worthwhile and may have detrimental effects. Instead invest time in learning ASP.net "well" (i.e. include state management).
n.b. I have found it tricky not to turn this into a classic ASP / ASP.net debate. Instead tried to concentrate on the learning.
You don't really learn ASP.NET, you'll learn a language such as C# or VB.NET. But yes .NET > !.NET
Why you should learn classic ASP at all? It is dead; no new work is done in it.
If you want to learn a programming model that works the way that the web works (Which Asp.net webforms does not, it is a leaky imitation of windows forms), there are modern models like ASP.Net MVC.
Learn the fundamentals first by writing static pages and understand the basic HTTP request/response model.
Then, move on to using server side technology. I'd recommend with Asp.Net Mvc if your head is not already filled with Asp.Net webforms model, however understand the tradeoff. Most likely you will have to deal with webforms sooner or later as majority .Net brownfield webapps are using that platform.
I would recommend just going with ASP.Net. ASP is so old a technology that they will have to learn so many work arounds to things that are common place.
I would also go with straight ASP.Net over MVC as the jury is still out (for me anyway) on how valuable MVC really is. It takes a lot of control away from the developer.

Resources