Posts

Preventing Cross-Site Request Forgery (XSRF/CSRF) Attacks in ASP.NET Core

MSDN blog to explain on Preventing Cross-Site Request Forgery Attacks in dot net core. https://docs.microsoft.com/en-us/aspnet/core/security/anti-request-forgery

Setting up Github with Git Bash

1)            Create an account on Github https://github.com/ 2)            Install Gitbash from following URL: https://git-scm.com/downloads 3)            Set up Github repositories: Go to start -> all programs -> git -> Open ‘Git bash’ On Command prompt: Step 1:            git config --global user.name "YOUR NAME"          Step 2: git config --global user.email "YOUR EMAIL ADDRESS" Step 3: Generate new SSH Keys as follows: Enter following command: ssh-keygen -t rsa -b 4096 -C "email@example.com" Press Enter Message displayed: Created directory '/p/.ssh'. Step 4: Create a passphrase: Enter your passphrase. ( it can be different than your password) Note: While setting pass phrase, the cursor doesn’t mov...

Performance Guide for Visual Studio in ReSharper

Nice blog from Resharper to explain the step by step guide to improve the Performace when we use ReSharper with Visual Studio. Most of our team members who are using the VM's from offshore will be benefiting from this Performance Improvements quide. Performance Guide for Visual Studio in ReSharper 2017.3

Don't use target="_blank" for your hyper links

Don't use target="_blank" for your hyper links instead use this rel="noopener noreferrer"

Entity Framework Migration Best Practices

1.       Introduction Like code is flown into version control system our database scripts will also be flown into the version control system and upgrading and downgrading the system should be straightforward. Before starting the Migration: Every developer should have their own local database for development. They can’t use the shared database for development. -          Steps for Migration Enable Migration This is one-time activity per team. Mostly the team lead when setting up the project will be doing this process. Add-Migration For every new migration activity, we will be using this command to start the migration. Update-Migration After the changes are done and the changes are ready to push to the database. We will use this Update-Migration to push the changes to the database. 2.      Workflow When using migration for a single person it will seem less and easy to use and wo...

Multi-Tenant Data Architecture

Image
Multi-tenancy Models When any application planned to roll out for multiple regions/countries/clients then multi-tenancy model comes into picture. This can be classified into four models as below -        Separate Application Separate Database -        One Shared Application and Separate Database -        One Shared Application and Shared Database (Separate Schema) -        One Shared Application and Shared Database (Same Schema) These models are differentiated based on whether the data is isolated or shared. The difference between the shared data and the isolated data is a continuum with many variations that are possible. Sample Application URL for different implementations. Tenant Name URL Tenant 1 Tenant1.domainname.com Tenant 2 Tenant2.domainnam...

New to .NET?

Then must study .NET documentation. (<10 mins needed) https://docs.microsoft.com/en-us/dotnet/standard/tour

How to find Microsoft .NET Framework Version Installed?

Image
To find .NET Framework versions by viewing the registry (.NET Framework 4.5 and later) On the  Start  menu, choose  Run . In the  Open  box, enter  regedit.exe . You must have administrative credentials to run regedit.exe. In the Registry Editor, open the following subkey: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full Note that the path to the  Full  subkey includes the subkey  Net Framework rather than  .NET Framework . Note If the  Full  subkey is not present, then you do not have the .NET Framework 4.5 or later installed. Check for a DWORD value named  Release . The existence of the  Release DWORD indicates that the .NET Framework 4.5 or newer has been installed on that computer. The value of the  Release  DWORD indicates which version of the .NET Framework is installed. Value of the Release DWORD Version 378389 .NET Framework 4.5 378675 .NET Frame...

Developer Cheat Sheet

Image

Sending Email from Powershell

The Powershell comand to send email. $smtpServer = "0.0.0.0" $smtpFrom = "from@gmail.com" $smtpTo = "to@gmail.com" $messageSubject = "Subject of the email" $messageBody = "Body of the email" $smtp = New-Object Net.Mail.SmtpClient($smtpServer) $smtp.Send($smtpFrom,$smtpTo,$messagesubject,$messagebody)

MVC - Looping through the model properties from cshtml

When ever we are struck with the values being not properly filled in the model and need to print all the properties of the model or dto of the page then we can use the below lines of code to loop through the model or dto and write all the items in the page. foreach (var result in Model)             {                                   var type = result.GetType();                     var properties = type.GetProperties();                     <ul>                         @foreach (var property in properties)                         {                         <li>     ...

Automatic redirection of HTTP to HTTPS Settings

Url Rewriting module of IIS to redirect to secure url IIS 7 web.config should have this tag  <system.webServer> <rewrite>     <rules>         <rule name="HTTP to HTTPS redirect" stopProcessing="true">           <match url="(.*)" />             <conditions>               <add input="{HTTPS}" pattern="off" ignoreCase="true" />             </conditions>           <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />         </rule>     </rules>     </rewrite> </system.webServer> IIS 8.x ma...

.NET 4.6 Bug - Tail Call bug in RyuJIT - Quick Guid

UPDATE: Tail Call Bug has been fixed and here is the more details about it. http://blogs.msdn.com/b/dotnet/archive/2015/07/28/ryujit-bug-advisory-in-the-net-framework-4-6.aspx The following information has been collected from the below mentioned links and from my Friends.  This post is just a reference purpose and needs lot of testing to implement this solution. Reference: http://nickcraver.com/blog/2015/07/27/why-you-should-wait-on-dotnet-46/ https://github.com/dotnet/coreclr/issues/1296 What is Tail Call? Wonder full Blog post on Tail Call is here:  http://blogs.msdn.com/b/davbr/archive/2007/06/20/enter-leave-tailcall-hooks-part-2-tall-tales-of-tail-calls.aspx Who should be worried about :  -           .NET Framework 4.6 is installed on the machine running the application -           The application targets the ‘Any CPU’ or ‘x64’ platform ...