Four Things Every ASP .NET Webform Developer Must Avoid At All Costs
It is a common occurrence to come across individuals who regard webforms as an inferior tool for ASP .NET development purposes, thanks to the emergence of such new updates as MVC. However, the professional developers themselves beg to differ. Many of them are still in favor of development using the webforms engine to drive a number of ASP .NET applications.
Irrespective of how popular MVC gets over the course of its lifetime, webforms is considered to be a mature platform for development purposes and features a vast number of applications all around the world. As a per a recent survey conducted by professionals, three out of four ASP .NET programmers and developers prefer the use of webforms for the purpose of various development projects.
Would it be a good idea now to raise questions surrounding the popularity of webforms in the development industry?
In spite of having a burgeoning popularity in the market, it is not uncommon to find professionals programmers following poor practices with regards to ASP .NET webforms development.
Let us discuss some of the problems that ASP .NET programmers face while undertaking their projects in the industry.
Rather than use CSS, choosing to work with control style properties
The main intention behind the development of ASP .NET was to replicate the experience afforded to the programmers as far as building desktop apps with the use of visual basics is concerned. With the use of VB6, a developer is given the opportunity of dragging the control on a design surface of a given view. Later on, they could set various properties such as colors, fonts, dimensions, etc.
The very same practice was later carried on by ASP .NET programmers to the world of professional development. The right practice to follow when using styles is to consider the various options referenced in external files. The developers need to place these references at the header line of the document. This will allow all styles to be loaded while the page is loading.
Following feature detection rather than browser detection
One of the most frustrating things for website visitors is to load a page in Internet Explorer and be greeted by a white blank page. There are a number of business apps that don’t work on any browser other than IE, more so the obsolete versions. Earlier ASP .NET programmers would design the apps in a manner so that they could detect the browser on the server and lead to production of browser-friendly content.
Rather than continue to focus on performing server-side browser detection with the use of libraries such as Modernizr, it is about time that the professionals made the switch to client-side feature detection capabilities. This will allow the application browsers to be detected with ease and support various features of the app that will allow it to run smoothly even on the oldest of browsing platforms.
Keeping EnableViewStateMAC set to false
EnableViewStateMAC, by default, is set to true. Under any circumstance whatsoever should it be set to false as it will make the web pages vulnerable to potential tampering.
Allowing client requests to run up for long duration
This will lead to the user experience on your website being ruined altogether and can also result in a number of issues as far as your browser performance is concerned. Under unavoidable circumstances, these requests should be migrated to an AJAX call or make use of certain tools such as SignalR for influencing the WebSockets. This way, you can return the requests to your clients and enable the server to process remaining requests while smoothening out the working or shopping experience for the visitor.
Let us hope that these points discussed above will help in the betterment of the community of ASP .NET programmers. You will get to understand the various things that are an integral part of every ASP .NET development project.