How does MVC architecture based URLs aid search engines to optimize searches - asp.net-mvc

How does MVC architecture based URLs aid search engines to optimize searches.
ASP.NET MVC urls follow different pattern compared with the web forms URL pattern. I see this listed as an advantage for search engines to obtain results. I am not able to understand how though.
There are questions on optimization but that is not what i am trying to ask.

this is pretty self-explanatory.
hxxp://www.yourdomain.com/buy/shoes/1337/all-stars/black/vintage
just works better than
hxxp://www.yourdomain.com/buy.aspx?id=1337&cat=5&variant=37
You don't really need an MVC framework to do this tough. URL rewrite can do a lot for you.
A well constructed MVC app will typically have a much more logical sitemap when you look at the urls on different levels.

Related

angularJS routing in asp.net MVC

I'm newbie in angular so i have two questions on AngularJS routing. Deeply sorry if this has been answered. tried a brief search, didnt find exact match.
I get the idea of SPA, the cost of asp.net server round trip,
however, what's a valid real world scenario that make best use of
both server side routing and client side routing together? or simply
give up the asp.net mvc routing at all?
If partial routing rules
defined on both side, isn't it a bit messy?
well, that depends on what you need I saw some people doing a mix of routes between angular and MVC, you can take a look to he boilerplate and hot towel projects for asp.net and angular combo take them as reference, both are like starter kits.
In my personal opinion (and this is subjective), I prefer to use a RESTFul architecture / SPA let angular do the routing and have web API or service stack as a middleware very much like the mean.js approach for me it's a cleaner and more natural for a SPA application.
take a look to this article that talks about rest API and some best practices.
I don't know if there's a perfect answer since it all depends on the project you're working on and the preferences of the dev team. I personally like keeping some of the MVC concepts (mvc views, routing, etc.) and just using angular for a given page's functionality. I don't make use of the angular routing at all. Obviously it would be a different story if you were trying to create a full SPA.
But I find that in a lot of cases (especially if working on an existing app written in MVC) you can introduce bets and pieces of angular without taking it all the way. If you're trying to get rid of page redirects entirely and want a full SPA experience then you should probably use a service approach instead as already suggested (if you want to stay with the Microsoft stack, Web API is a good option).

how to use breezeJS in asp.net webforms

i have been lately read some articles about BreezeJS. But till now i can't get my head around it.
What exactly BreezeJS is used for in details with examples not just words?
Can i use it in asp.net WebForms(most of tutorials target MVC projects), and if so how can i use it ?
Is there any concerns i need to take in consideration before i use it ?
I'm going to break your first question into two pieces:
Do you want to build a JavaScript / Single Page Application?
If you want a cross-platform application with a more fluid user experience, or have a need for offline operation, then Single Page Applications may be a good fit for you.
Why should I use Breeze in a Single Page Application? Can you cite examples?
John Papa has a great post about this that includes a few examples:
http://www.johnpapa.net/spajs04
You can use WebForms, MVC, or any number of other technologies to build a Single Page Application. For ASP.NET, people typically use MVC4 though. Here is StackOverflow post on that topic that might help:
webforms vs asp.net mvc for single page application - which to choose?

MVC 4 / Razor in layman's terms

I'm sorry if this is a stupid or obvious question, but I've spent the better part of a week researching, and I really can't find any resources that explain what MVC 4 and Razor are, and what they are intended to do in web development. I'm not necessarily asking for a really detailed description, even a link to a website or the name of a book that doesn't explain MVC 4 by referencing other technologies that I have also never used. I've looked through articles, articles and tutorials on everything from MSDN to graduate papers and I just don't get it.
I know what MVC the design pattern is, but one of the main things I can't get a straight answer to is what the difference is between MVC the pattern and MVC 4 the framework. As a web developer, will I ever have to change or make use of the frameworks, or is it something that is supposed to "stay out of your way" (to quote another SO post.) Is it something that gets generated by VS and I will never have to touch?
Again, I'm sorry if this is obvious, maybe I'm trying to make this more complicated than it actually is. All I have been looking for is a straight forward answer with concrete examples that don't contradict or complicate it any further.
Please...I'm at my wits end here. My last question was apparently too vague and got voted down and closed, so I tried to be more specific, but part of my problem is what are the right questions to ask.If there is anything that can say to clarify,please tell me.
I certainly don't want to discourage you any more than you appear to be at the moment, but in my opinion, if you can't make head or tail of the huge amount of material that already exists on MVC, then perhaps you are just not ready for it yet. That's OK - in fact Microsoft recognise that MVC is complicated, which is why they introduced the ASP.NET Web Pages framework (which is what gave birth to Razor syntax).
My advice would be to follow the link and download WebMatrix. Then follow some of the Web Pages tutorials. That way you can get your head around Razor without worrying too much about MVC for the time being.
Incidentally, ASP.NET MVC is a web development framework that enables you to build web applications based on the MVC pattern. You need to understand how MVC works in order to make use of the framework. You need to understand what Models are, what Views are and the role that Controllers play in the whole thing.
The framework itself is not an example of MVC.
Razor is a templating syntax that allows you to intermix C# (or VB) with HTML to output dynamic content in a View in MVC or a page in the Web Pages framework.
I know it may seem confusing, but it seems to me that you are over complicating things.
The simple matter is that MVC is a design pattern. That is, it's an abstract thing.. a philosophy of sorts. It's not a concrete thing. A design pattern simply gives you a description of how the pattern is supposed to work, and while it may give you a sample implementation, in general it leaves that implementation up to you.
ASP.NET MVC (whichever version) is a specific application framework that uses the MVC pattern as its basis. In other words, it's a concrete implementation of the MVC design pattern.
In fact, the ASP.NET MVC implementation isn't even a "true" implementation of the MVC design pattern, as certain compromises are necessary to make it work in a web based model. So it's really more "MVC design pattern inspired".
You're overthinking things. Just accept that ASP.NET MVC is a framework library that implements and MVC design pattern.
As for Razor, it's merely a templating library. That is, it allows you to define a page layout as text, and insert values at specific places (place-holders). It also allows code to be executed during the process of rendering a template, although this is discouraged in MVC except for very simple cases.
Razor is also used in ASP.NET WebPages technology, in those cases it tends to be more like PHP or classic asp in that all code exists in code blocks within the template itself. Both ASP.NET and WebPages use the Razor templating engine (also called a View Engine) but they use them in different ways.

What enterprise sites are using ASP.NET MVC / MVC 2? Need justification for management for moving to MVC

I've tried a few google searches and stack over flow searches, but this is proving hard to find than I thought. I need to provide justification to management for our shop to move to ASP.NET MVC 2. The biggest help would be any enterprise level sites or major web development shops that are using ASP.NET MVC 1/2.
Does anyone have a list or link?
I know Stackoverflow uses it, but some stats such as daily views would help too. I found the Jwaala case study here: http://www.microsoft.com/casestudies/case_study_detail.aspx?casestudyid=4000006675 . Aside from that, I'm having some issues finding some professional examples.
Thanks in advance!
Just found a few more case studies:
http://www.microsoft.com/casestudies/Case_Study_Search_Results.aspx?Type=1&Keywords=mvc&LangID=46#top
Could still use more links.
If your management requires a "...but THEY're doing it!!!" justification then you have larger problems.
If you're using the "...but THEY're doing it!!!" justification then you'll likely need much better reasons.
Hate to troll, but just saying that you'll want objective and project-specific reasoning. And if by "management" you mean business-management, then they need to understand that engineering details are best left up to engineering. The Art of War by Sun Tzu is full of advice along these lines.
...and to qualify this, I'm a web-developer working on a partial rewrite of a WebForms app. I'd love to be using MVC for this project, but the actual benefit of doing so doesn't match the cost--business is business after all, and the business-case must be considered.
If you do get stuck with WebForms then you can whip it into shape (what we're doing). With ASP.NET 4.0 (or a little inheritance trickery) you can get rid of the ID renaming; by building ViewModels, domain-objects, and clean Repositories you can avoid a lot of the cruft of WebForms--we have tight, explicit control over what WebForms generates. We've shrunk the actual content of our ASPX pages and their codebehinds by at least an order of magnitude by applying best practices.
Just remember, the tools won't make you a better developer, and unless you know what you're doing or what you're working with then you won't reap the benefits.
Dell is rebuilding its page from ASP.NET Webforms into ASP.NET MVC as Phil Haack is mentioned this on his blog ;)
I can not say if they use MVC 1 or MVC 2.
It seems that MarketWatch use ASP.NET MVC with Spark View Engine as listed here :
http://sparkviewengine.com/spark-in-the-field
http://www.marketwatch.com/
also an e-commerce webiste :
http://www.fancydressoutfitters.co.uk/
Check our sites www.reifen.com and www.bonspneus.fr. They handle pretty big traffic in germany and france.
We have used ASP.NET MVC 1 on these sites and still use (and enjoy) ASP.NET on other sites. Like others said: don't just go with ASP.NET MVC because it is in some way better. It is not. There is allways a situation where I would prefer one or the other.
Additional "live" ASP.NET MVC sites (some broken links)
http://weblogs.asp.net/mikebosch/archive/2008/05/05/gallery-of-live-asp-net-mvc-sites.aspx

When and why should I consider asp.net MVC?

I've noticed a lot of talk about asp.net MVC lately, but I haven't come across a clear or compelling description of when, where or why I would want to use it over WebForms.
Let's say I wanted to build a small web application that allows a person to advertise some items online. The website will have 4 use cases:
Search adverts
View listings
View item
Place an advert
Let's assume:
I'm not particularly interested in unit testing my controller. The page will either render the list of items correctly, or it won't.
I am interested in more control over the HTML markup.
I'm not interested in using the latest buzz technology just for the sake of it.
I am interested in using the tool that is best suited to the job in terms of productivity, performance, maintainability & simplicity of the end solution.
I don't want to have to work around a bunch of nuances to get something simple to work.
So, my questions are thus:
What are the fundamental differences between the two models?
In which scenario is one better than the other?
What are the gotchas with asp.net MVC (I'm aware of the gotchas with WebForms)
For our sample app, what would I gain by using asp.net MVC instead of WebForms?
For our sample app, what would I lose by using asp.net MVC instead of WebForms?
Is it feasible to mix and match models within the same small application?
Thanks to anyone who spends the time to contribute an answer.
What are the fundamental differences between the two models?
WebForms try to mimic WinForms development by allowing you to reuse lots of pre-made controls, and by faking web application state via the hidden _VIEWSTATE mechanism.
MVC is a pattern designed to help you separate your data (Model), business logic (Controller) and presentation (View). It adheres more to the true nature of the web : RESTful URLs, stateless.
In which scenario is one better than the other?
In my opinion, for an intranet application making heavy usage of controls, WebForms can be useful at reducing development time, because thanks to the designer you can create your UI very quickly and let the framework manage the app's state automatically.
For any other project, especially a public website, even a small one, I think MVC is the way to go.
What are the gotchas with asp.net MVC (I'm aware of the gotchas with
WebForms)
I'd say there is some learning curve to fully understand the MVC pattern and its power. Also, since the framework is still in BETA you can expect the API to experience some minor changes before release.
Since JavaScript is not hidden from you in MVC, it would also require some time to learn if you're not familiar with it. jQuery greatly simplifies this though.
For our sample app, what would I gain by using asp.net MVC instead of
WebForms?
You'd gain better control over HTML markup and Javascript behavior, a cleaner separation of concerns and some easily testable codebase (even if you don't seem interested in unit testing it).
For our sample app, what would I lose by using asp.net MVC instead of
WebForms?
You'd lose the 'drag and drop' quick way of building your pages and the application state management.
Is it feasible to mix and match models within the same small
application?
In some ways, yes it seems.
I'd recommend watching this talk by Phil Haack, who gives a good overview of the framework and invites Jeff Atwood to talk about how he built StackOverflow with it.
He explains how SO is using some WebForms controls for CAPTCHAs which render themselves into the view.
The primary difference is that MVC is more like "regular" web development that the rest of the programming world uses, whereas standard ASP.NET was designed to make it brain-dead easy for Windows developers to become web developers. I learned web programming by learning Ruby on Rails, and MVC seems like it is becoming the .NET version of Rails.
MVC is much more oriented around standards compliance, unobtrusive javascript, and separation of concerns than regular ASP.NET. You'll need to understand how HTML and CSS work together. You'll learn a LOT more javascript as you master MVC. One of the biggest advantages of MVC to me is that you can use jQuery to do some amazing AJAX stuff easier and BETTER than you can in regular ASP.NET.
If you're just now learning web development then I strongly encourage you to learn MVC. You'll be able to transfer at least some of your new skills to other frameworks in the future.
If you're looking for which to learn to quickly get a web development job, then I'll have to strongly suggest ASP.NET.
Once MVC is RTM'd I think we will see a slow and steady adoption curve and as it matures MVC may become the primary framework for creating websites with ASP.NET. I hope so at least!
The biggest difference between ASPNET MVC and is WebForms is the lifecycle of an page, no difficult(unnecessary) postbacks, clean coding, enz.
There are no rules for that
???
REST-full website, Separation of logic
Design-time support, can't use third-party webcontrols
Please don't mix it together. If you really want to use the WebForms model you could use the MVP pattern, Billy McCafferty wrote exellent articles on that design pattern
I'm redesigning some of my applications from the MVP-pattern to MVC-pattern, not because MVC is better but I would like to use the newest techniques offered by MS(pattern itself is quite old).

Resources