Posts

Showing posts with the label Dotnet

Logging in .NET Core: Built-in Logging vs Serilog with Full Implementation Guide

Logging in .NET Core: Built-in Logging vs Serilog with Full Implementation Guide Logging is an essential aspect of application development. In .NET Core and beyond (.NET 5/6/7/8), Microsoft provides a built-in logging framework that is simple to use. However, when applications grow and logging needs become more advanced, third-party solutions like Serilog shine. In this blog, we will explore built-in logging, Serilog, their differences, and how to implement both in your .NET Core application.   1. .NET Core Built-in Logging Overview .NET Core uses Microsoft.Extensions.Logging as a base logging interface. This logging abstraction allows logging to multiple destinations, such as: Console Debug EventSource EventLog (Windows only) Azure Application Insights (via extensions) Files (through third-party integrations) Pros: Simple to use Built-in Fully integrated with Dependency Injection (DI) Cons: Limited formatting op...

What is .NET Core? A Complete Beginner’s Guide to the Future of Development

What is .NET Core? A Complete Beginner’s Guide to the Future of Development Whether you're just stepping into the world of programming or you're a seasoned developer exploring modern frameworks, .NET Core is a name you’ve probably come across. But what exactly is it? Why is everyone talking about it? And how can you use it to build powerful, modern applications? Let’s dive into the complete beginner’s guide to .NET Core —now part of the unified .NET platform —and discover why it’s one of the most in-demand tools for developers today.   What is .NET Core? .NET Core is a free , open-source , and cross-platform development platform from Microsoft. It’s designed for building a wide range of applications—everything from web apps to cloud services, microservices, desktop apps, and more. Since .NET 5, Microsoft has unified .NET Core into a single platform simply called .NET , with versions like .NET 6, .NET 7, and the latest .NET 8 leading the way.   Purpose of .NE...

Implementing Single Sign-On (SSO) in .NET Core and Angular

Implementing Single Sign-On (SSO) in .NET Core and Angular Introduction Single Sign-On (SSO) is a powerful authentication mechanism that enhances user experience and security by allowing users to log in once and access multiple applications without re-entering credentials. In this blog, we will walk through the implementation of SSO using OAuth 2.0 and OpenID Connect (OIDC) with IdentityServer4 in .NET Core and Angular. Why Use SSO? Improved User Experience : Users authenticate once and access multiple services without repeated logins. Centralized Authentication : Easier user management and security enforcement. Better Security : Reduces password fatigue and encourages strong authentication policies. Scalability : Works well across multiple applications, making it ideal for enterprise solutions. Step 1: Setting Up IdentityServer4 in .NET Core IdentityServer4 is an open-source framework that enables authentication and authorization using OpenID Connect and OAuth2. 1.1 Cr...

ANgular List and Drop down

  Step 1: Setup Angular Service for HTTP Requests Create a service to handle fetching data from the backend. ng generate service data In data.service.ts, implement the necessary HTTP calls to get data. // data.service.ts import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { Observable } from 'rxjs';   @Injectable({   providedIn: 'root' }) export class DataService {     private apiUrl = 'https://your-api-url.com/api';   // Replace with your backend API URL     constructor(private http: HttpClient) { }     // Fetch the list of items (example data for display)   getItems(): Observable<any[]> {     return this.http.get<any[]>(`${this.apiUrl}/items`);   }     // Fetch dropdown data for first dropdown (Example: categories)   getDropdown1Data(): Observable<any[]> {     retur...

Pass values to another components

Pass values to another components  : 1. Create a Shared Service with a Subject First, create a service to manage the data passing. ng generate service shared-data Now, let's implement the service (shared-data.service.ts). // shared-data.service.ts import { Injectable } from '@angular/core'; import { Subject } from 'rxjs';   @Injectable({   providedIn: 'root' }) export class SharedDataService {     // Create a subject that will hold the data to be shared   private dataSubject = new Subject<any>();   // You can specify a type here   data$ = this.dataSubject.asObservable(); // Create an observable from the subject     constructor() { }     // Method to send data to other components   sendData(data: any): void {     this.dataSubject.next(data); // Emit data to subscribers   } } dataSubject: A private Subject that will emit values. data$: An...