Skip to main content

Posts

Showing posts from November, 2019

.NET Core: Session Wrapper Design Pattern For ASP.NET Core

Here, we'll learn about Session Wrapper design pattern to ease the access of Session. We'll make our access of session "Typed". Also, we may apply any validation or constraint in this wrapper class. Step 1 - Create a Session Manager class   In this example, we are going to store two items in Session (i.e. ID & LoginName). We are injecting IHttpContextAccessor so that we can access the Session variable.  We are creating properties which are actually accessing Session variable and returning the data or writing the data to Session. We have added one helping property "IsLoggedIn" which is using other properties to make a decision. We may have more such helping/wrapper properties. using Microsoft.AspNetCore.Http; public class SessionManager       {           private readonly ISession _session;           private const String ID_KEY = "_ID";           private const String LOGIN_KEY = "_LoginName";           publ

.NET Core: All About Sessions In ASP.NET Core

We'll quickly discuss how we used to use Sessions before ASP.NET Core and then we'll see how to access Sessions in ASP.NET Core. Session In Pre-ASP.NET Core era You get Session functionality by default (without adding any package) Previously, you would have accessed Session by - Session variable in your Controllers/Forms System.Web.HttpContext.Current.Session in places where you don't have direct access to the Session variable. Anything you store in session is stored as Object. You store values in Key/Value format. Session["mydata"] = 10;     Or to access on those places where Session is not available (e.g. Non-Controller classes) System.Web.HttpContext.Current.Session["mydata"] = 10;     Quite difficult to mock Session Object for Unit Testing  Session in ASP.NET Core 2.2 Now, Session is not available by default. You need to add the following package. Meta package by default provides you this. <PackageReference Inc

Project Management - Ten Popular Myths About Leadership and How to Overcome Them

Close your eyes for a second and conjure-up a mental image of a leader. What do you see? Do you picture a politician, CEO or military leader? It’s easy to see why these type of images come to someone's mind. Leaders are often viewed as someone who is decisive, smart and outgoing. In some cases, leaders may appear just a little bit intimidating. The problem with an image that suggests an aggressive persona of authority is that it can prevent some potentially strong leaders from pursuing leadership roles or reaching their full potential. It's easy to misconstrue and have a misconception of what a leader is and isn’t. With that in mind, let’s identify 10 of the most popular myths about leadership so that you can discover new opportunities and effectively take charge of your team. 1. Entrepreneurial leadership. There’s an assumption that all entrepreneurs are natural-born leaders. The reality is that just because you had a fantastic and timely idea doesn’t mea

Remember to think about the user (Customer Experience)

How The OSI Works

Diagram of the OSI Model Refer to it as you read the 'Step-by-Step' section below, HOW THE OSI MODEL WORKS - STEP BY STEP Network-capable  Applications  produce  DATA . Each layer in the OSI Model adds its own information to the front of the data it receives from the layer above it. This information in front of the data is called a  header  and contains information specific to the protocol operating at that layer. The process of adding the header is called  encapsulation . Encapsulated data is transmitted in  Protocol Data Units (PDUs). There are  Presentation  PDU's,  Session  PDU's,  Transport  PDU's etc. Thus, PDU's from an upper layer are encapsulated inside the PDU of the layer below it. PDU's are passed down through the stack of layers (called 'the stack' for short) optionally repeating the encapsulation process until they can be transmitted over the  Physical   layer. The physical layer is the wire connecting all the computers on the

The OSI Model's Seven Layers

APPLICATION LAYER The OSI model defines the application layer as being the user interface. The OSI application layer is responsible for displaying data and images to the user in a human-recognizable format and to interface with the presentation layer below it. Examples of applications that utilize the network are: Telnet FTP Instant Message software (AIM, MSN, ICQ, Yahoo) Microsoft Windows File Shares Web Browsers (Internet Explorer, Firefox, Google Chrome, Safari) Network games of Doom, Quake, Unreal (first-person 3D shooter video games) IRC (mIRC) PRESENTATION LAYER The presentation layer handles the conversion of data between a Standards-based or platform independent formats to a format understood by the local machine. This allows for data to be transported between devices and still be understood. The presentation layer performs the following functions: Communication with the application layer above. Translation of data conforming to cross-platform standards int

What is the OSI Model

Open Systems Interconnect ( OSI) Model The International Standards Organization (ISO) developed a theoretical model of how networks should behave and how they are put together. This model is called the Open Standards Interconnect (OSI) Model. The OSI Model is a theoretical, seven-layered model of how networks work . The OSI Model is a theoretical model of networking that organizes network functions into seven layers, Physical layer Datalink layer Network layer Transport layer Session layer Presentation layer Application layer It specifies the communication interfaces between the OSI Model's layers and between network endpoints utilizing an OSI Model-based protocol suite. The OSI Model is a way of thinking about how networks work. The OSI Model is a theoretical model The OSI Model is not a technology . The OSI Model is not a protocol . The OSI Model is not a program or software . The OSI Model sorts network communication functions into seven layers.

OSI Model vs TCP/IP Model

There are two network models that describe how networks work . The OSI Model , the older model, was designed for the OSI protocol stack. While different organizations were battling over standards, Vint Cerf and Bob Khan worked out the TCP/IP software from which the TCP/IP Model was co-designed. The diagram below shows how the two networking models compare, and how the logical and physical networking protocols relate to the layers in each of the two models. There are seven layers in the OSI Model , only four in the TCP/IP model . This is because TCP/IP assumes that applications will take care of everything beyond the Transport layer. The TCP/IP model also squashes the OSI's Physical and Data Link layers together into the Network Access Layer. Internet Protocol really doesn't (and shouldn't) care about the hardware underneath, so long as the computer can run the network device and send IP packets over the connection. See also, What is the OSI Model? How The OSI Wo