The Transport Layer Security (TLS) 1.2 is a stadnard that provides security improvements over previous versions. More and more thrid-party APIs were configured to disable any requests from clients that were using TLS 1.0/1.1. So if your ASP.NET Web App or WebAPI Services Web Site will need to update to TLS 1.2 as well if your ASP.NET Web App or WebAPI Services Web Site has some calls to the third-party APIs, otherwise they will only return empty responses.
You could disable TLS 1.0/1.1 and only enable TLS 1.2 in your Web Server or in Azure, so that your hosting environments will no longer accept requests from earlier version of TLS.
But what happens on your application (ASP.NET Web App or WebAPI Services)? Depend on what version of .NET framework your project usrs will dicate the possible solutions available to you.
- If your project compiles against .NET Framework 4.7 or above, then you don’t have to do anything.
- If your project has been developed in a earlier version of .NET Framework, then you could either
- Recompile your project using .NET Framework 4.7 or above
- If recompiling is not an option, then you will have to update your .config file as below,
<compilation targetFramework="x.y.z" />
<httpRuntime targetFramework="x.y.z" />
It is preferred that x.y.z are the same. So if your application is 4.6.2, then replacing x.y.z into 4.6.2.
Microsoft also has post a useful document on describing the best pratices to TLS 1.2. It will be great if you could read them all and understand them in order to fully secure your application(ASP.NET Web App or WebAPI Services).
VS Keyboard Shortcuts are needed for almost all developers in their daily life.
If you need a cheat sheet of handy keyboard shortcuts for VS2017, you can have a look on the image in this post or you could download the PDF for easy printing.
A Graphic is much more readable than Text. It also apply to “what’s new in VS2017” in a image. Take a look on it.
You could download the poster in PDF or as an Image
Recent I start working on MVC with BootStrap for building the great Web UI. I am building a menu with several menu items and found out that it is not setting as “active” in the class of the item when a page is loaded.
By default the MVC template doesn’t add the active class to the “li” item in the menu. So I have to add the class=”active” to the “li” to indicate the active menu item.
Above is the code that is used for the actual menu that create the menu in the first screenshot. if you look at line 8, you will see the class=”active”, this is what makes the active menu item. In order for us to do this, we need to know what page is currently loaded and then apply the active class css to the corresponding “li” element. The best way to do this, is to create a HTML helper to handle this for us.
Now, let’s try to create a new folder in the project and called “Helpers”. Then add a new class named “HtmlHelpers.cs” (from my sample, I used KenLinHtmlHelpers). here we could create an extension method of the HtmlHelpers method. We do this by creating a static class.
As you can see, I have created 2 method, IsActive and IsActiveController. The only difference is, do you want to take Action into one of the input parameter. If you want to set class is active whenever it is in the specific controller, you could use IsActiveController. Otherwise, you may use IsActive if you want the active class only in exactly the specified Action and Controller. Please also note that, I am letting the activeClass and inActiveClass input as optional with a default value.
Now we could update our cshtml as below,
Look carefully on each “li” item now. There is a new HtmlHelper method to check and show if it is the active controller. Please also look carefully, I have also called the method in line 9, for the parents of the dropdown Menu.
NOTE: You have to reference the class in the top of the view page that you are using the IsActive or IsActiveController method in. Just add the code as line 1 of the above screenshot.
Last 2 weeks, I run MVC training kit to IIS 7.5 and was trying to figure out the baseline for the performance tuning for my project. I tested 3 Scenarios,
S1) Hosting MVC 1.0 Training Kit in Application under Default Website
S2) Hosting MVC 1.0 Training Kit in New Website with port 8081
S3) Hosting my company’s MVC Project in New Website with port 8082
And their result of max throughput on Default Page is around,
R1 Result Screen Shot
R2 Result Screen Shot
This time, I tested in more scenarios,
S4) Moving MVC 1.0 Training Kit to root of Default Website
S5) Hosting MVC 1.0 Training Kit in Application under New Website with port 8081
S6) Hosting my company’s MVC Project in Root of Default Website
And their result now are,
R4 Result Screen Shot
R5 Result Screen Shot
R6 Result Screen Shot
OK, let me group the result in a table and so we could view all results more clear.
|MVC 1.0 Kit in Default Website
|MVC 1.0 Kit in New Website with port 8081
|Company MVC Project in Default Website
|Company MVC Project in New Website with port 8082
Now the results are showing that
1) The performance will be gained about 10% if you move the MVC project from Application under website into root of website.
2) The performance will be gained in a range from 240% – 1325% if you move the MVC project from Default Webste to New Website.