Tech Support Websites

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg
Showing posts with label ASP.NET-MVC. Show all posts
Showing posts with label ASP.NET-MVC. Show all posts

Thursday, 13 June 2013

Pros and Cons of Single Page Applications (SPAs)

Posted on 11:20 by Unknown
A SPA is a web app contained in a single page – where ‘pages’ are nothing but DIVs being shown/hidden based on the state of the app and user navigation.

Single Page Applications heavily use client side scripting to provide rich functionality to the end user.

Gmail is probably the first well known SPA implementation which has been around since 2004.

ASP.NET MVC 4 provides a basic framework for building SPA applications.

Pros:
The big reasons to do SPA are the 3 R's: Reach, Responsive UX and Reducing roundtrip postbacks.

Cons:

  1. Navigation – SPA’s by nature break the normal navigation mechanism of the browser. Normally, you click a link, it launches off a request and would update the url on the address bar. The response is then fetched and painted. In an SPA however, a link click is trapped in JS and the state is changed and you show a different div (with a background AJAX request being launched).
  2. This breaks Back/Forward navigation and since the URL doesn’t change, bookmark-ability is also broken to boot.
  3. SEO – SEO also breaks because links are associated with JavaScript and most bots cannot follow such links.

A SPA is not a good fit where SEO is important but it can be used for a banking app or an app that shows personalized info where SEO is not required.
Read More
Posted in ASP.NET-MVC | No comments

Thursday, 23 May 2013

ASP.NET MVC 4 Questions and Answers

Posted on 09:50 by Unknown

Q) What is the name of the unit testing Framework that is available with a ASP.NET MVC 4 Project in Visual Studio?
MSTest

Q) Which code will execute before any of the Controllers are run?
The code within Application_Start() in global.asax will start executing before any of the Controllers run

Q) Which HTTP status code does a RedirectPermanent ActionResult return?
RedirectPermanent returns a 301 status code

Q) How does ASP.NET know how to deliver a request like http://localhost/home/about?
Routing engine (not tied to ASP.NET MVC Framework) directs requests to Controllers. The route map is defined in global.asax

Q) What is NuGet?
It is a Package Manager for .NET applications. NuGet can be used to install, update and configure software (DLLs) in the form of Packages, for use in a Visual Studio project. This way you don't have to download it or track dependencies. NuGet understands package dependencies & will fetch dependent packages as well.

Q) Where do NuGet Packages come from?
1. NuGet official feed of packages (from nuget.org)
2. Your local repository
3. Your network share
    Q) Where do NuGet Packages go?
    When you install a NuGet package it goes into the Packages folder within the Visual Studio Solution from where you requested. It stores the Package on a per solution basis, not putting in the GAC or Program Files. It is local to that Solution. This makes it easy to update and put a package under version control. The Packages.config file within a Visual Studio solution lists all the Packages that have been installed for the project

    Q) What is in a NuGet Package?
    A *.nupkg is a zip file that contains:
    Metadata - dependencies, URLs, version numbers are specified in a XML file
    Binaries - assemblies (DLLs)
    Other content - scripts, images, code blocks

    Q) Can NuGet commands be executed from the command line?
    Yes, using PowerShell. To view the list of commands, open the Package Manager Console in Visual Studio (View > Other Windows > Package Manager Console) & type help package

    Q) Which is the namespace you have to include when you're using DataAnnotations?
    System.ComponentModel.DataAnnotations

    Q) Where does the Razor Layout View reside?
    The Layout View in Razor (the equivalent of Master Page in ASP.NET WebForms) resides in the Shared folder under the Views folder. It is represented by the _Layout.cshtml file

    Q) How does MVC runtime know that it has to use _Layout.cshtml?  
    Q) What is the significance of the _ViewStart.cshtml file?
    _ViewStart.cshtml resides in the root of the Views folder. It contains a code block containing a Layout property set to the the _Layout.cshtml file. It is a Razor convention that anything inside  _ViewStart.cshtml will execute before a View does. _ViewStart.cshtml applies to all Views. It can be overriden on a per View basis.

    Q) What does a Razor Layout page contain?

    Razor Layout pages are HTML files that define a Body and additional sections by using the following instructions:
    @RenderBody(): Renders the content of a page that is not within any named sections.
    @RenderSection("mySectionName"): Renders the content of the section within the given name. Sections are mandatory by default, so each page linked to the template will have to declare them.
    @RenderSection("mySectionName", optional:true): Renders the content of an optional section. The pages that are linked to the template can omit the definition of an optional section.

    Q) How to ignore the default Layout view?
    To avoid using the default Layout page, set Layout property to null

    Q) Can you build your own custom HTML Helpers?
    Yes, you can build your custom HTML Helpers

    Q) What does the Razor WebGrid Helper do?
    The WebGrid Helper renders an HTML table that displays data from the model or from a database. It
    supports data formatting, paging and sorting.

    It generates a collection of Columns and parameters within the given data source, which is rendered as an
    HTML table that can be accessed after the grid is generated.

    Q) What does @: in Razor represent?
    @: makes Razor interpret a string as literal text

    Q) What are the project templates presented to you by Visual Studio when you start a ASP.NET MVC 4 Project?
    Empty - empty ASP.NET MVC 4 Project
    Basic - basic ASP.NET MVC 4 Project
    Internet Application - a default ASP.NET MVC 4 Project with an account controller that uses Forms Authentication
    Intranet Application - a default ASP.NET MVC 4 Project with an account controller that uses Windows Authentication
    Mobile Application - an ASP.NET MVC 4 Project for mobile devices with an account controller that uses Forms Authentication
    Web API - a ASP.NET Web API Project

    Q) What are Action Filters? Give examples.
    Action Filters are the components that are used to apply cross-cutting logic i.e logic that has to be executed across multiple controller actions so that you don’t have to duplicate code inside of individual controllers.

    Action Filters supply pre and post processing logic to a controller action and its result

    Global filters are applied at application startup. 

    Examples:
    OutputCache - caches the output of a Controller
    Authorize - restricts an Action to authorized users or roles
    ValidateAntiForgeryToken - helps prevent cross site request forgeries
    HandleError - can specify a view to render in the event of an unhandled exception.

    work in progress...

    Read More
    Posted in ASP.NET-MVC | No comments

    Wednesday, 24 April 2013

    Default ASP.NET MVC 4 Solution created with Basic Template is 24MB!

    Posted on 10:30 by Unknown

    While copying a basic ASP.NET MVC 4 project sample from a different machine, I noticed that the project created using the Internet Application template was a whooping 27MB in size.

    The Packages folder takes up 27.4MB while the DLLs (47 of them compared to 29 in the MVC 3 project template) in the Bin folder were 5MB in size.

    The default ASP.NET MVC 4 Solution created with Basic Template was 24MB (Packages folder - 18MB, Bin folder - 4.34MB)

    Is there really a chance that anyone uses all of the DLLs?

    I looked up what some of the non-Microsoft DLLs among the list of 47 DLLs do -
    • Antlr:  (ANother Tool for Language Recognition) is a powerful parser generator for reading, processing, executing, or translating structured text or binary files. It's widely used to build languages, tools, and frameworks. 
    • DotNetOpenAuth:  Compiled library that adds support for your site visitors to login with their OpenIDs by just dropping an ASP.NET control onto your page.
    • Newtonsoft.Json: Json.NET is a popular high-performance JSON framework for .NET 
    • WebGrease: suite of tools for optimizing javascript, css files and images. 
    If you were looking at a ASP.NET MVC project and wanted to know if it was built using version 3 or 4, a quick way would probably be to look at the count of DLLs in the bin folder.
    Read More
    Posted in ASP.NET-MVC, Trivia | No comments

    Thursday, 1 September 2011

    Compare ASP.NET Hosting Providers

    Posted on 19:52 by Unknown
    Microsoft's Web Hosting Gallery has a neat tool to let you search for hosting providers based on parameters like type of server (shared, dedicated, virtual server) cost, technologies supported (Frameworks, Databases, Publishing protocols), storage, number of SQL Databases, number of e-mail accounts, bandwidth per month, support, uptime.


    Also see:
    Tips on ASP.NET Hosting & Deployment

    Read More
    Posted in ASP.NET, ASP.NET-MVC | No comments

    Wednesday, 31 August 2011

    Types of ASP.NET MVC View Engines

    Posted on 05:31 by Unknown

    A view engine provides Controllers with the ability to translate views into HTML. There are multiple reasons why you may choose one view engine over another. Here is a list of different types of ASP.NET MVC View Engines, the first two are available with ASP.NET MVC 3 -
    • WebForms /ASPX – classic ASP.NET MVC views

    • Razor (CSHTML)

    • Spark

    • NHAML -  (pronounced enamel) is a pure .NET implementation of the popular Rails Haml view engine.

    • NVelocity 

    • Brail

    It is possible to use multiple view engines in the same project

    Related reading:
    ASP.NET MVC View Engine Comparison
    Spark and NHaml - Crazy ASP.NET MVC ViewEngines

    Read More
    Posted in ASP.NET-MVC | No comments

    Sunday, 20 March 2011

    ASP.NET MVC Usage Trends

    Posted on 11:12 by Unknown
    As per the BuiltWith website, there are 34,183 websites using ASP.NET MVC and among them, 1,840 websites are within the top million most visited sites on the internet.


    Also see:
    Large sites that run on ASP.NET
    Read More
    Posted in ASP.NET-MVC | No comments
    Older Posts Home
    Subscribe to: Posts (Atom)

    Popular Posts

    • 10 ways to make laptop battery last longer
      Paraphrased from a Right Choice magazine article with my own opinions: Keep the brightness of the screen as low as possible. If portability ...
    • What is the difference between Browser Mode & Document Mode in IE
      If you're a web developer and your job actively involves building web pages that work the same in all browsers including the last three ...
    • Manipulate PDF files for free with PDFRider
      PDFRider (currently in version 0.5) is an open source project on Codeplex. This utility provides a GUI for the command-line program  Pdftk ...
    • HOW TO try Windows Azure for free (without any credit card)
      Windows Azure, Microsoft's cloud platform offers .NET developers a great opportunity to extend their skills to this new platform. You do...
    • NDepend - a powerful .NET code analysis tool
      Nearly a decade ago, I was amazed when a not-so-technical project manager gave detailed feedback on my C# code in a project I was working on...
    • What does the "www" in a website URL mean?
      This NYTimes technical post explains it well: The “www” is a subdomain, a specific area within the domain, but not all sites will use it. I...
    • A new JavaScript Reference to bookmark
      For years, the JavaScript section at W3Schools.com has been a indispensable source of reference for me . It will now not be my only source. ...
    • HOW TO check what HTML5 features a browser supports
      Now that I'm getting my feet wet in HTML5, I thought I should spend more time with features that are supported by all popular browsers r...
    • Book Review: Don't Make Me Think
      The second edition of Don't Make Me Think by Steve Krug which came out in 2005 is a short 200-page stylish book on Web Usability. It ha...
    • Web apps in less than 10 KB
      There have been over 350+ submissions to the  10K Apart contest conducted by Microsoft & Event Apart that has a prize money of over $10...

    Categories

    • AJAX
    • Android
    • APIs
    • App
    • ASP
    • ASP.NET
    • ASP.NET-MVC
    • Azure
    • Azure SQL Database
    • AzureInPictures
    • Bing
    • Book Review
    • Bookmarklet
    • Browsers
    • C#
    • chart
    • Chrome
    • Cloud
    • CSS
    • CSS3
    • DidYouKnow
    • E-Commerce
    • Excel
    • FB
    • Fiddler
    • Firefox
    • Gadgets
    • GeoLocation
    • GMail
    • Google
    • Google Docs
    • Google Reader
    • Health
    • Hotmail
    • HOWTO
    • HTML
    • HTML/CSS
    • HTML5
    • Humor
    • Hyderabad
    • IE
    • IIS
    • India
    • Internet
    • IT
    • Javascript
    • jQuery
    • JSON
    • JSONP
    • Laptop
    • Learning Resources
    • Lists
    • Map
    • Metrics
    • Microsoft
    • miscellaneous
    • Mobile
    • NAPA
    • Office365
    • Opera
    • PDF
    • Performance
    • Personal
    • PHP
    • PM
    • PowerShell
    • Privacy
    • Programming
    • Rant
    • Safari
    • Science
    • Search Engines
    • SearchEngines
    • Security
    • SEO
    • Sharepoint
    • SharePoint2013
    • Silverlight
    • Software Engineering
    • Solutions
    • SQL Azure
    • SQL Server
    • TFS
    • Tip
    • Tips
    • Tools
    • Tools/Utilities
    • Trivia
    • TWIL
    • Twitter
    • UX
    • VM
    • VS.NET
    • VS2010
    • VS2012
    • WCF
    • WebApps
    • Websites
    • WF
    • Windows Phone
    • Windows7
    • Windows8
    • Word
    • WP7
    • WPF

    Blog Archive

    • ▼  2013 (112)
      • ▼  October (16)
        • 10 ways to make laptop battery last longer
        • Learnings in S/W Engineering from the HealthCare.g...
        • TWIL - Week #29
        • MS currently has 21 apps on Google Play, incl. Wor...
        • Review: uCertify PMI PMP v-5 Online PrepKit
        • TWIL - Week #28
        • HOW TO highlight a Province within a Country with ...
        • My first impressions of Nexus 7 tablet
        • Free APIs, online services to generate screenshots...
        • TWIL - Week #27
        • HOW TO prevent mixed content warning in web pages
        • What's common between Kovid Goyal & Antony Lewis?
        • TWIL - Week #26
        • FB & Twitter spam me with similar subject line
        • Book Review: PMP Rapid Review by Sean Whitaker; MS...
        • Windows Azure Mobile Services - Error: Table 'some...
      • ►  September (14)
      • ►  August (8)
      • ►  July (8)
      • ►  June (13)
      • ►  May (12)
      • ►  April (12)
      • ►  March (8)
      • ►  February (15)
      • ►  January (6)
    • ►  2012 (127)
      • ►  December (11)
      • ►  November (14)
      • ►  October (13)
      • ►  September (14)
      • ►  August (16)
      • ►  July (16)
      • ►  June (6)
      • ►  May (5)
      • ►  April (11)
      • ►  March (12)
      • ►  February (7)
      • ►  January (2)
    • ►  2011 (98)
      • ►  December (5)
      • ►  November (2)
      • ►  October (5)
      • ►  September (7)
      • ►  August (7)
      • ►  July (15)
      • ►  June (10)
      • ►  May (7)
      • ►  April (8)
      • ►  March (10)
      • ►  February (11)
      • ►  January (11)
    • ►  2010 (163)
      • ►  December (14)
      • ►  November (19)
      • ►  October (19)
      • ►  September (15)
      • ►  August (18)
      • ►  July (17)
      • ►  June (20)
      • ►  May (17)
      • ►  April (19)
      • ►  March (5)
    Powered by Blogger.

    About Me

    Unknown
    View my complete profile