ASP.NET Razor web pages on large project? - asp.net

I'm on the point of starting a medium scale web application and I'm considering developing using ASP.NET Razor syntax Web Pages framework (not MVC). But as I've seen many people consider "Web Pages" to be tailored towards beginners.
I'm developing professional large scale web applications in ASP.NET Web Forms for several years now, but I've always inclined towards clean html/javascript code more than server side controls therefore I find Razor syntax very much appealing. I'm using Visual Studio and not considering web pages for helpers functions or other beginner eye candy features.
Having this in mind what are your opinions on scalability, speed, long term development on this approach?

In terms of performance WebPages is asp.net and gets compliled so performance should be similar to WebForms and MVC.
I'd say that any site that could be built using ClassicASP, PHP or WebForms (without using server controls) can be built just as well using WebPages.
I prefer WebPages over WebForms and MVC for my sites. You get full control over the HTML, don't need to worry about concepts like the page lifecycle and postsbacks unlike WebForms. On the other side you get a lightweight, simple framework where you don't need to use VS.net, solutions files, project files and 3+ files to serve up a single page and you don't need to compile the entire solution before deploying unlike MVC.
But what you use I think depends mostly on your detailed requirements and skillset.

But as I've seen many people consider "Web Pages" to be tailored towards beginners.
Go for the ASP.NET MVC 3 and the Razor view engine then. It provides you with the WebPages syntax coupled with the full power of the MVC pattern built on top of an established platform such as ASP.NET in terms of scalability and long term development. You can't dream for better as far as the Microsoft stack is concerned.

Related

Confusion on using asp.net or mvc

Ive been confused about ASP.NET MVC.
As some said, MVC is better than ASP.NET. As some said, they are completely the same thing.
And my colleges debate that MVC is just an extension of asp.net, where asp.net is already in the form of MVC.
In fact I am starting web developing from scratch. If someone might help to clear the fog front of me, it would help a lot.
All ASP.NET web frameworks are build on top of Microsoft ASP.NET Framework. The unique feature of Web API is that it can be used with both MVC and WebForms applications to provide truly restful HTTP services.
Regarding the choice of suitable Asp.NET framework: you may get more information from official source - www.asp.net.
General rule of thumb is the architectural design how you want to build your application.
ASP.NET MVC promotes a cleaner separation which makes the developer think more in depth about design and code separation than traditional web forms.
There are endless debates about what is better but true benefits of ASP.NET MVC as
testability
more control over the rendered HTML
separation of concerns. However with MVC there is much more to learn for the developer.
ASP.NET WebForms - will always be around because some see it as a rapid application development tool. Just drag and drop and let ASP.NET handle the posting, state etc
ASP.NET Web API - is a framework that makes it easy to build HTTP services that reach a broad range of clients, including browsers and mobile devices. ASP.NET Web API is an ideal platform for building RESTful applications on the .NET Framework.
All in all, each of them has certain business solutions to be considered as required.
References to look for comparison:
ASP.NET MVC vs WebForms: speed and architecture comparison
ASP.NET Roadmap: One ASP.NET – Web Forms, MVC, Web API, and more
ASP.NET is the name of the overall web framework. There are a few different technologies that are built on ASP.NET. Two popular examples of these technologies are WebForms and MVC.
WebForms promotes a programming model that looks a lot more like Windows Forms. It attempts to abstract away the stateless nature of the web, and encourages you to use server-side controls instead of HTML. Because WebForms was the primary way to write web applications on ASP.NET for a long time before MVC came out, you'll often see people talk about "ASP.NET" as the same thing as WebForms. This is part of the reason for your confusion. ASP.NET WebForms is very different from ASP.NET MVC, but they are both built on ASP.NET.
ASP.NET MVC gets away from server-side controls. It eliminates the abstractions, allowing you to have closer control over the actual HTML that gets generated. For developers of modern applications, this is very useful because it makes it much easier to use AJAX and rich client-side javascript.
(Humble Opinion incoming)
ASP.NET (in terms of using Webforms) is programming the web for a WinForms developer. You "bind" events, you have "controls" and everything (sessionstate) is stored in a huge hidden field within the page so it knows where it left off from the previous call. You rely heavily on this information being present which is why everything you do needs to reside in that master form wrapping the entire page.
On the other hand, MVC is bringing C# .NET programming back to the web the way the web was intended. No bloat, no hidden fields, no heavy bindings. It's brings everything back to the classic "i have this form and now I need to process it". Arguably, the real magic is the routing methods and the "automatic binding" of submitted fields to an object. (if fields x, y & z are submitted and your action is looking for FooBar with the properties x, y & z it's automatically converted for you.
ASP.NET is common to both WEB-API and ASP.NET MVC. I assume you wonder about MVC or WEB-API.
MVC is a controller / model based with Views. Although the controllers can be used for AJAX json purposes. MVC is a good way to build a serious Browser based Application. The WEB-API allows you to build simple http server features, not necessarily Browser related. Good for REST style programming. Very flexible and a good alternative to WCF services. The are good tutorials on Both on the official ASP.NET site. START here http://www.asp.net/get-started
choose depends on your project n you. I suggest you to choose MVC because its productivity is very high we r using it since 1 year and found better than webforms.
for more knowledge please visit http://www.asp.net/mvc
The choice depends completely on you, I have been developing MVC application since 2010, its going to be over 2 years now have worked with almost all the versions of MVC both with Razor and aspx view. I have also worked on ASP.Net webform based applications.
With MVC you will not get built in controls, you will have to develop every control you want to use, you will have to rely mostly on html controls, while with web forms you will get advantage of using built in controls, Even getting help from other developers in your surroundings may be easy for webforms as you can easily get a webform developer.
But on the other hand with MVC the maintability is very high. As for as productivity is concerned, its very high once your are accustomed to it, initially it will be low as you will be in learning phase. Don't forget to use Entity Framework.
You may also consider developing your App using WebAPI, if it suits your scenario.

New to ASP.NET: Webforms vs MVC2

I am new to ASP.NET Development and can't decide between developing with Webforms or MVC 2. Nevermind the pros and cons of each. I've seen mixed opinions of each. But which method would be the best for someone who has no prior experience in ASP.NET or C#?
If your answer is: learn both, then which should I learn first? MVC 2 or Webforms?
I was in a similar situation to you a year ago. I'm a Computer Science student, well finished my course around a month ago. First two years of my course I worked with Java, PHP, Oracle, MySQL. This actually landed me an industrial placement at Oracle where I used their ADF which was Java based.
Anyway all of this made me start thinking about what I wanted to use for my final year project and with no experience of Microsoft technologies began to venture down that path. I wasn't aware of ASP.NET MVC and spent time learning ASP.NET WebForms. I liked the easy style of development, drag and drop is a very quick way of developing small sites. However I also disliked the lack of control I had and the simplicity, I didn't feel overly challenged.
During my final year I started to research Model View Controller and how it suits web applications. From this I came across ASP.NET MVC and in my opinion its far better than ASP.NET WebForms. There seems to be an emerging trend in MVC frameworks for web applications and this seems to be the hot technology to build web applications in.
Now finished I can say that teaching myself ASP.NET MVC was one of the best things I did. I don't know if you're British based, but only two Universities in Britain teach .NET. This made getting a graduate job much easier and I stood out from .NET candidates because I was from a Java course, the same as yourself.
The transition from Java to .NET is not particularly difficult all the theory and concepts are the same. Also ASP.NET MVC is becoming quite popular among businesses which specialise in the Microsoft technology stack. As it is quite a new technology learning now whilst young will be an advantage. I've ended up in a job where the company are rewritting their application from ASP.NET WebForms to MVC and only myself and the senior developer have ever used MVC leading to quite a large role in the project.
If you're interested my final year research can be found here and I have a chapter on ASP.NET WebForms and MVC
My source code is also on my site but its mainly MVC 1.0 not 2.0
Tough question.
What's your background in web development? Are you familiar with the MVC pattern?
Are you learning it for a job?
ASP.NET Web Forms are easier for beginners, as it hides much of the underlying implementation details of the ASP.NET engine.
ASP.NET MVC requires a deeper understanding of concepts such as routing and HTTP methods.
But yes - you should learn both.
As MVC is a new platform for developing ASP.NET Web Applications, i would learn Web Forms first. That way you will appreciate the benefits of MVC more when you contrast it to Web Forms.
if you want to get your hands dirty and really understand how the web works, go MVC
if you want to drag and drop your way to a functional but overhead loaded website, use webforms.
really, this question is pretty difficult to answer not knowing your background. if you're comfortable with html, css, javascript it may not be too difficult to pick up MVC. if you're new to the web entirely, it can be daunting to learn that many technologies all at once and webforms abstracts a lot of that kind of stuff for you.
There's a third option, especially useful for developers new to ASP.NET. You can use ASP.NET Web Pages, which is different from ASP.NET Web Forms. ASP.NET Web Pages is great for new developers as well as developers new to Web development. Also, it has a good path to migrate up to the complexity of ASP.NET MVC. In fact, the latest release of ASP.NET MVC and the latest release of ASP.NET Web Pages both use the same view engine.
Here is a link to the complete ASP.NET Web Pages book:
Getting Started with WebMatrix and ASP.NET Web Pages
Also, here is the complete WebMatrix Content Guide:
WebMatrix Content Guide
Here's the description:
WebMatrix is a free, lightweight set of web development tools that provides the easiest way to build websites. It includes IIS Express (a development web server), ASP.NET (a web framework), and SQL Server Compact (an embedded database). It also includes a simple tool that streamlines website development and makes it easy to start websites from popular open source apps. The skills and code you develop with WebMatrix transition seamlessly to Visual Studio and SQL Server.

Asp.net MVC VS ASP.net WebForms?

I am starting a new project in VB /.Net Framework 2.0 for a company corporate website with data driven forms. So should I go further with Asp.net MVC or Asp.Net web forms and WHY ??? We are not ready for Ajax now but later.
And also we have DevExpress components.
Actually I see ASP.NET MVC as next generation in that it is an evolution - trying to be a better programming environment, as software development for web apps asks for something more testable.
It is a huge beast. Decide based on features whether you need it. MVC has less documentation and is a lot harder to master thanks to a less RAD approach, but it seems that once you are in, it will be quite a better experience. If you have a web application (like stackoverflow.com) then it may be a good approach.
DevExpress components - have fun... throwing them away. Like most ASP.NET components they will not work or only work very partially. Totally different approach.e
ASP.Net MVC is not "next generation" ASP.Net. It's an alternative approach to design that can be more beneficial depending on the kind of project you're working with. Without more information about the particular type of project you're working on no one can give you any informed recommendations.

How is the best method to generate a url with ASP.NET?

I will apprecaite your help in this topic.
I need to build a site with friendly urls using url rewriting in order to improve SEO positioning.
I've been searching torought web and finally pointing to this two main options :
asp .NET with isapi extension
asp .NET mvc
however, I got no experience on both items so I need you to help me to kwow further about this two technologies and to take the right decision for my needs.
Thanks
There are much bigger concerns than just URL setup when making this choice. You're talking about two completely different architectures for building your web pages.
You should make the decision on how you want to build your application, what skillsets you have available in your developers, etc. Both approaches will be able to handle the URLs that you need to generate for SEO considerations.
For public facing websites, I would personally choose ASP.Net MVC, because I find the development cycle shorter, more productive, more flexible and more maintainable than an ASP.Net webforms application.
Assuming you have a host/server that can run ASP.NET MVC (i.e. one that has the .NET Framework 3.5 Service Pack 1 installed on it), you can use the Routing Engine (System.Web.Routing) from ASP.NET MVC in a web forms environment, Phil Haack has a good updated walkthough at "Using Routing With WebForms".
There's also "How to: Use Routing with Web Forms" on MSDN.
Unlike an ISAPI filter, this enables you to use the routing engine to generate your internal links as well as responding to well formed links from outside.
I agree with womp. But there is one advantage i see in Asp.Net webforms that Asp.Net Mvc doesn't have: Rich Client Iteraction controls. Everything in Mvc in View layer is simple and functionality need to be build from scratch.
alexserver - at the same time of course, the fit between mvc and jquery is an overwhelming reason to abandon the rich clinet controls. that way, you can literally get your designer and/or a jquery UI expert to work on the view portions in isolation whilst you craft the model and controllers.

New to ASP.NET

I am wanting to learn ASP.Net and am just a beginner. I have done some windows c# forms development before but have no experience of web development.
I have looked at the ASP.net website but beyond this, does anyone have any ideas as to good learning resources particulary in relation to the differences to windows development. For instance, It seems that the way events work is quite different under ASP to windows forms.
Thanks you all.
Thank you very much. I will have a look at MVC. It looks even more complicated but if this is the way things are going then I would be better maybe to invest my learning in this.
I would advise you at this stage in ASP.NETs life to instead direct your attention at ASP.NET-MVC. This url http://www.asp.net/mvc/ is a very good resource for learning.
ASP.NET Forms do a good job of hiding the nature of a connection-less HTTP/browser based technology and presenting a familiar Form with controls and lots of useful events environment that Windows Forms developers are used to.
However this approach comes with a price. For any serious project there is no avoiding getting under the hood of ASP.NET forms and properly understanding the underlying technology. At this point you start to realise the significant compromises the ASP.NET Forms has had to make in order to make Windows Forms developers feel at home.
ASP.NET-MVC, on the other, makes no such compromises. Learning MVC means learning how HTTP works up-front. It also has the advantage of being a much more test friendly approach which when used properly will save you days of debugging.
ASP.NET website - seriously, it's a really good resource.
I'd seriously consider starting with ASP.NET MVC. You'll end up learning what you need from ASP.NET "classic" but you'll pick up all the goodness of MVC (testability, seperation of concerns in your code etc) instead of learning bad habits.
Google for "ASP.NET MVC", check out ScottGu's blog, Scott Hanselmans's blog, or search StackOverflow for ASP.NET MVC (use the ASP.NET MVC tag too).
One good place to start...
http://weblogs.asp.net/scottgu/archive/2009/04/01/asp-net-mvc-1-0.aspx
I know they are a bit out of date, but I still think the two Fritz Onion books give a great look at what's happening in ASP.NET under the hood.
Some resources:
asp.net (as you mentioned)
channel9
scott hanselman's blog (some useful entries)
Windows Client Homepage
W3Schools Tutorials (Useful for more than just .NET, but this is the .NET page)
I've been a .NET Windows Forms (not Web forms) developer for 1 and a half years. Then I switched jobs and started using WebForms for like... 2 years. Then I discovered ASP.NET MVC (January 2008) and since then although I still master ASP.NET WebForms I will always prefer ASP.NET MVC.
My recommendation also goes into ASP.NET MVC. You will have to learn HTTP, HTML and a bit of Javascript but after these you will master web development on ALL PLATFORMS.
A great alternative to ASP.NET MVC is ASP.NET Web Pages with Razor syntax. In fact, the latest release of ASP.NET MVC and the latest release of ASP.NET Web Pages both use the same view engine.
Here is a link to the complete ASP.NET Web Pages book:
Getting Started with WebMatrix and ASP.NET Web Pages
Also, here is the complete WebMatrix Content Guide:
WebMatrix Content Guide
Here's the description:
WebMatrix is a free, lightweight set of web development tools that provides the easiest way to build websites. It includes IIS Express (a development web server), ASP.NET (a web framework), and SQL Server Compact (an embedded database). It also includes a simple tool that streamlines website development and makes it easy to start websites from popular open source apps. The skills and code you develop with WebMatrix transition seamlessly to Visual Studio and SQL Server.

Resources