Introduction to ASP. NET MVC boilerplate

Source: Internet
Author: User

Introduction to ASP. NET MVC boilerplate

ASP. NET MVC boilerplate is a professional ASP. NET MVC template used to create a secure, fast, strong, and adaptable Web application or site. It provides the least demanding code implementation on top of the Microsoft default MVC template.

Key benefits of using this template:

    • Safety
    • Performance
    • Search engine Optimization (SEO)
    • Accessibility
    • Browser compatible
    • Resiliency and error handling
    • Simple commissioning and performance testing tools
    • Design Patterns and best practices
    • Search

ASP. NET MVC Boilerplate technology roadmap

Why do I need ASP. NET MVC boilerplate?

The default MVC template provided by Visual Studio does not work well with the tool. It is non-secure, slow, and consists only of very basic features. ASP. NET MVC boilerplate provides a partial solution to get you started quickly. It allows for free use and provides checklists to help you identify the tasks you need to do to make your apps and sites more complete.

The remainder of this article will explore the improvements for the MVC template. At the end provides how to use it. At the same time, provide improvements that will be made in the future, where you will explore the details of each feature.

Default security

The default MVC template is not secure. The various settings, most of which are in the Web. config file, are not default-safe. For example, it exposes the version of IIS used and allows external scripting to access cookies by default.

The ASP. NET MVC boilerplate uses security options by default and uses a variety of HTTP headers sent to the browser to request and respond strictly.

A new content security Policy (CSP) HTTP header is also used by using the Nwebsec NuGet package. CSP guarantees Web security, and it is highly recommended to read the links above.

Setting up SSL/TLS allows your site to run on top of HTTPS, which you can configure with the links and instructions above.

Default Fast

The default MVC template does not consider performance issues. It is possible that they do not consider which Web server to use. Almost all ASP. NET MVC sites use IIS and are configured in the Web. config file in the system.webserver section, which is especially important for performance impact.

The ASP. NET MVC boilerplate has no assumptions. It opens gzip compression for static files and dynamic files, making them smaller and faster to download before being sent to the browser. It also uses the Content distribution network (CDN) by default so that generic scripts such as jquery can be quickly downloaded.

Not only this! There are many other examples of tuning and best practices to help improve ASP. NET MVC boilerplate performance by 96/100, and the benchmark uses YSlow.

Search engine Optimization (SEO)

The default ASP. NET MVC template does not consider search engine optimization. ASP. Boilerplate adds dynamically generated robots.txt files that tell search engines which pages can be indexed. Adding dynamically generated sitemap.xml files helps search engines further provide access to all of your pages.

ASP. NET MVC has many useful settings for appending a slash address to the URL and having all the URLs lowercase. But unfortunately, all of these are closed by default, which is really bad for SEO. This project opens all of these settings.

It also contains an MVC filter to help redirect non-standard URLs to their standard addresses.

Accessibility

The world's 4% people have visual impairments and 0.55% are blind. More statistics can be obtained from this point. ASP. NET MVC boilerplate guarantees the accessibility of your site by adding ARIA features to your HTML tags and special icons for people who use screen reading.

Browser compatible

Sites need to meet the majority of access through a variety of devices. ASP. Boilerplate supports browser-to-IE8 (IE8 still occupies 4% of the market share).

The ASP. NET MVC boilerplate also supports other devices in the desktop browser. It includes default icons and can be displayed for Windows 8, Android, Apple devices, and a few other special devices.

Resiliency and error handling

The site throws an exception and you need to process and log the exception so that you can easily understand and fix it. The ASP. NET MVC boilerplate contains Elmah, the most popular log plugin has been pre-provisioned in the template.

ASP. NET MVC boilerplate uses a popular content publishing network (CDN) from Google and Microsoft, and if not, ASP. Boilerplate provides backup.

There are not only standard error pages such as the Internal Server error, 404 Not Found, and many other error pages built into the last class. The ASP. Boilerplate even contains the IIS configuration to protect against Denial-of-service (DoS) attacks.

Simple commissioning and performance testing tools

The ASP. NET MVC boilerplate uses Glimpse (in view of Scott Hansleman's propaganda). It's a good tool for developing and finding performance issues and flaws. Of course glimpse is pre-set and does not need to be installed.

Design Patterns and best practices

It takes time to do the right thing. Use control inversion (IOC) as the default mode. The ASP. NET MVC boilerplate uses AUTOFAC as the IOC default container. Many other containers work well, choosing AUTOFAC because there are many ASP. NET MVC helper classes and Microsoft uses it to work with Azure Mobile services.

ASP. Boilerplate also uses popular less files to make CSS easier.

ASP. NET is a complex monster, encounter a lot of magic strings, to be renamed can be said to be an abnormal nightmare. There are many ways to deal with this type of problem, but performance is poor. The ASP. NET MVC boilerplate widely applies constants to maintain the balance between maintainability and performance.

Atom seeds

Atom 1.0 is included by default. Choose Atom instead of RSS because it is a better specification for updates. Pubsubhubbub 0.4 is built-in support that allows you to push seed updates to subscribers.

Search

There are many ways to implement search. The ASP. NET MVC boilerplate contains search features, but gives you the freedom to choose how you want to implement them. It also implements the open Search XML. Please read Hanselman to discuss this feature here.

Social

The Open Graph meta tag and the Twitter Card meta tag are included by default. More than that, ASP. Boilerplate includes a full-text, document-enabled HTML helper class that allows you to easily generate an open graph object or a Twitter card that satisfies the simplicity and correctness of the tag.

How to get

Select the following options to get:

    1. Download Visual Studio 2013 to expand this and select the file in Visual Studio à new project Àweb
    2. To clone a git repository:

git clone https://github.com/RehanSaeed/ASP.NET-MVC-Boilerplate

Release notes and to-dos list

You can find the release notes for each version here, as well as find new features and upcoming enhancements here.

The future of the project

The author tries to create a Visual Studio deployment package (VSIX) and lists the project templates in the Visual Studio extension. In order to use the template, you only need to easily select the ASP. NET MVC boilerplate from the online template, in the File à new project à online template menu. Incredibly, it's actually complicated to create. The author found the Export Template Wizard Visual Studio extension.

Creating different Visual Studio templates at the same time includes the ASP. NET Web API and OAuth authentication.

Introduction to ASP. NET MVC boilerplate

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.