Here are 7 simple tips to help you improve your .NET website:
Bundling and minification are two techniques you can use in ASP.NET 4.5 to improve request load time. Bundling and minification improves load time by reducing the number of requests to the server and reducing the size of requested assets.
See my article for how to do this.
To keep your code tidy and to add code to sections of the page from lower level templates, it is good practice to render sections.
See Scott Gu's blog post for examples of this.
You should always add a favicon. Lots of browsers look for it by default even if it is not referenced on the page, they look for it at the root of your site. If you have a high-traffic site, your server will generate a 404 error for each first request of it.
Read this article to find out more.
I prefer to have my domain running from a www address so I create a rewrite rule to direct requests that don't have a www at the beginning to the address with it on. There is talk that it is better to redirect www to the address without it these days, but I still think it is better to go to www. Whichever you chose, make sure all of your traffic goes to one.
Read this article in google support pages to find out more about why this is a good idea.
Read my article for how to do this in Umbraco.
You should set up a custom error page for 404 errors and one for 500 errors. The 404 page will be used when a page isn't found and sometimes for minor errors when you can still serve the custom 404 error page. The 500 error will be used when there is a server error.
To get this set up in my sites, I create a page called error, just under the homepage. I get the source of this page create a 500.html page and save it at the root of my site.
In the web.config for the site you can add the following to enable these custom errors:
<!-- inside system.web -->
<customErrors mode="On" redirectMode="ResponseRewrite">
<error statusCode="404" redirect="/Error"/>
<error statusCode="500" redirect="/500.html"/>
<!-- inside system.webServer -->
<httpErrors errorMode="Custom" existingResponse="Replace">
<remove statusCode="404" subStatusCode="-1"/>
<remove statusCode="500" subStatusCode="-1"/>
<error statusCode="404" prefixLanguageFilePath="" path="/Error" responseMode="ExecuteURL"/>
<error statusCode="500" prefixLanguageFilePath="" path="/500.html" responseMode="ExecuteURL"/>
XML Sitemaps help search engines find pages faster, reducing the amount of time it takes to index your site.
Have a read of my blog post to find out how to create one in Umbraco
This is a text file at the root of your site which tells search engine crawlers like google which pages in your site it can or can't crawl. It also tells them where your sitemap is.
Here is a useful article to help you understand them.
I hope this helps you with building your websites, please do let me know if it does by commenting. Please also feel free to comment if you have any other good tips.
This post shows you how I created a handler to create dynamic header images for my umbraco website u…Read Post
In this post I show you how you can send Slack messages programmatically using C#Read Post
In this post I show you how to solve the SVG 404 error when working with Umbraco and Azure Blob Stor…Read Post