Posts

Showing posts from 2022

C# Reflection

Image
 In C#, reflection is a process to get metadata of a type at runtime. The System.Reflection namespace contains required classes for reflection such as: Type MemberInfo ConstructorInfo MethodInfo FieldInfo PropertyInfo TypeInfo EventInfo Module Assembly AssemblyName Pointer etc. The System.Reflection.Emit namespace contains classes to emit metadata Reflection in C# provides objects (of type Type) that describe assemblies, modules, and types. You can use reflection to dynamically create an instance of a type, bind the type to an existing object, or get the type from an existing object and invoke its methods or access its fields and properties. Reflection is needed when you want to determine or inspect the content of an assembly. Here, content means the metadata of an assembly like what are the methods in that assembly, what are the properties in that assembly, are they public, are they private, etc How to Implement Reflection in C#? So, now we are going to write a simple example imp...

IISRESET vs App Pool Recycling ?

Image
 I think most IIS administrators know IISRESET command, and why they use it. One of possible reasons can be to restart IIS services to initialize web applications, or to apply some changes of applications & IIS settings .There’re just a few conditions those need your IISRESET command. In most situations, you don’t need this. I have a concern if you always run this command for applying any changes, or release system resource – memory – regularly, or frequently. Because it’s much more cost than what you really need to take – there’re side effects Recycling App Pool’ has been introduced from IIS6 in Windows2003. It’s designed to restart only application pools(=worker processes). It can be done in a command prompt(run ‘IISAPP /?’ in a command prompt for details), as well as in the IIS manager What IISRESET does? When you run IISRESET, many things will happen. In order to understand them, I think I need to show you how IIS looks like – about IIS core components. The below shows you ...

.NET Core vs .NET Framework?

Image
 A while back, we predicted that . NET Core would be the next big thing, offering developers many options in application development. Indeed, there is huge demand for developers skilled in this technology. But how does it differ from the . NET Framework , and what do you need to know to use them both effectively? Today, we’ll contrast .NET Core vs  .NET Framework to help you choose which one to use for your next project. In this post, we’ll explain their key differences and how to make the best use of each.  Look at history of .NET Framework below for more understanding. Historically, the .NET Framework has only worked on Windows devices. The Xamarin and Mono projects worked to bring .NET to mobile devices, macOS and Linux . Now, .NET Core provides a standard base library that’s usable across Windows, Linux, macOS and mobile devices (via Xamarin). There are four major components in .NET architecture Common language specification (CLS) defines how objects are impl...

Culture and UI Culture for ASP.NET Web Page Globalization

 In an ASP.NET Web page, you can set to two culture values, the Culture and UICulture properties. The Culture value determines the results of culture-dependent functions, such as the date, number, and currency formatting, and so on. The UICulture value determines which resources are loaded for the page Note The Culture and UICulture properties are set using Internet-standard strings that identify the language (for example, en for English, es for Spanish, and de for German) and culture (for example, US for the United States, GB for Great Britain, MX for Mexico, and DE for Germany). Some examples are en-US for English/United States, en-GB for English/Great Britain, and es-MX for Spanish/Mexico. For more information, see CultureInfo The two culture settings do not have to have the same value. Depending on your application, it might be important to set them separately. An example is a Web auction site. The UICulture property might change for each Web browser, whereas the Culture stays...

Azure SQL Managed Instance

Image
 Azure SQL Managed Instance is the intelligent, scalable cloud database service that combines the broadest SQL Server database engine compatibility with all the benefits of a fully managed and evergreen platform as a service. Azure SQL database and Azure SQL Managed Instance are PaaS SQL Managed Instance provides support for instance-scoped features enabling easy migration of existing applications, as well as sharing resources among databases With SQL Managed Instance, confidently modernize your existing apps at scale by combining your experience with familiar tools, skills and resources and do more with what you already have. Azure SQL Managed Instance Connection String Server=test-azuresqlmanagedinstance-demo.public.43eb3ae38165.database.windows.net,3342;Persist Security Info=False; User ID=demouser;Password=demouser#1234;MultipleActiveResultSets=False; Encrypt=True;TrustServerCertificate=False;Connection Timeout=30; If you enable Public end point then we can access SQL Managed I...

What is Contained DataBase?

SQL Server 2012 Onwards we have a new solution termed as contained database. Contained database is defined as a database which has the database user without logins. It includes all settings related to databases along with its metadata, thus system will be having no dependency with SQL server login. Users can easily connect to a contained database without having to go through the log in at DB engine. Contained database feature provides two containment modes: None – By default each database has its mode set as NONE. This means there is no contained database feature being used. Partial – With partially contained databases, we can define boundaries between databases and the server, so the metadata will exist inside the databases. It makes SQL Server databases more portable and less dependent on underlying hosts.  A contained database is a database that is isolated from other databases and from the instance of SQL Server that hosts the database Isolated from other databases Isolated fro...

JWT?

Image
  What is JWT? JSON Web Token (JWT) is the approach of securely transmitting data across communication channel. For authentication and authorization, it uses the technique of passing digitally signed tokens. JWT comprises of three parts: Header, Payloads and Signature. Header is used to identity the signing algorithm used and it appears like: { “ alg ”: “ HS256 ”, “ typ ”: “ JWT ”} Payload looks like: { “ Name ”: “ Ramana Reddy ,” Admin ”: “ true ”,” iat ”: “ 146565644 ”} The signature is created by Base64 encoding Header and Payload as: data = encoded ( Header ) + “.” + encoded ( Payload ) signature = HMACSHA256 ( data , secret key ); More details about JWT can be referred from  https://jwt.io/ JWT in Theory JWT authentication process can be broken into following 4 steps- 1) User is validated against database and claims are generated based on user’s role. 2) Payload containing claims or other user related data is signed with key to generate token and ...