
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 2587 Articles for Csharp

7K+ Views
ASP.net Core is re-architected from prior versions of ASP.net, where the configuration was relying on System.Configuration and xml configurations in web.config file. In ASP.net Core, a new easy way to declare and access the global settings for solution, project specific settings, client specific settings etc..The new configuration model, works with XML, INI and JSON files.Different configuration json files in ASP.net Core There are mainly 6 configuration JSON files in ASP.net Core.global.json launchsettings.json appsettings.json bundleconfig.json project.json bower.jsonglobal.jsonExampleYou can define the solution level settings in global.json file.{ "projects": [ "src", "test" ], "sdk": { "version": "1.0.0-preview2-003121" ... Read More

18K+ Views
Session is a feature in ASP.NET Core that enables us to save/store the user data.Session stores the data in the dictionary on the Server and SessionId is used as a key. The SessionId is stored on the client at cookie. The SessionId cookie is sent with every request.The SessionId cookie is per browser and it cannot be shared between the browsers.There is no timeout specified for SessionId cookie and they are deleted when the Browser session ends.At the Server end, session is retained for a limited time. The default session timeout at the Server is 20 minutes but it is ... Read More

5K+ Views
Routing is used to map requests to route handlers.Routes are configured when the application starts up, and can extract values from the URL that will be used for request processing.Routing basicsRouting uses routes (implementations of IRouter)map incoming requests to route handlersgenerate URLs used in responsesRouting is connected to the middleware pipeline by the RouterMiddleware class. ASP.NET MVC adds routing to the middleware pipeline as part of its configurationURL matchingIncoming requests enter the RouterMiddleware which calls the RouteAsync method on each route in sequence.The IRouter instance chooses whether to handle the request by setting the RouteContext Handler to a non-null RequestDelegate.If ... Read More

5K+ Views
We can configure middleware in the Configure method of the Startup class using IApplicationBuilder instance.Run() is an extension method on IApplicationBuilder instance which adds a terminal middleware to the application's request pipeline.The Run method is an extension method on IApplicationBuilder and accepts a parameter of RequestDelegate.signature of the Run methodpublic static void Run(this IApplicationBuilder app, RequestDelegate handler)signature of RequestDelegatepublic delegate Task RequestDelegate(HttpContext context);Examplepublic class Startup{ public Startup(){ } public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory){ //configure middleware using IApplicationBuilder here.. app.Run(async (context) =>{ await context.Response.WriteAsync("Hello ... Read More

3K+ Views
Middleware are software components that are assembled into an application pipeline to handle requests and responses.Each component chooses whether to pass the request on to the next component in the pipeline, and can perform certain actions before and after the next component is invoked in the pipeline.Map extensions are used as convention for branching the pipeline.The Map extension method is used to match request delegates based on a request’s path. Map simply accepts a path and a function that configures a separate middleware pipeline.In the following example, any request with the base path of /maptest will be handled by the ... Read More

2K+ Views
The configure method is present inside startup class of ASP.NET Core applicationThe Configure method is a place where you can configure application request pipeline for your application using IApplicationBuilder instance that is provided by the built-in IoC containerThe Configure method by default has these three parameters IApplicationBuilder, IWebHostEnvironment and ILoggerFactory .At run time, the ConfigureServices method is called before the Configure method. This is to register custom service with the IoC container which can be used in Configure method.IWebHostEnvironment :Provides information about the web hosting environment an application is running in.IApplicationBuilder:Defines a class that provides the mechanisms to configure an ... Read More

5K+ Views
An external application can be run from a C# application using Process. A process is a program that is running on your computer. This can be anything from a small background task, such as a spell-checker or system events handler to a full-blown application like Notepad etc.Each process provides the resources needed to execute a program. Each process is started with a single thread, known as the primary thread. A process can have multiple threads in addition to the primary thread. Processes are heavily dependent on system resources available while threads require minimal amounts of resource, so a process is ... Read More

2K+ Views
A media type, also called a MIME type, identifies the format of a piece of data. In HTTP, media types describe the format of the message body. A media type consists of two strings, a type and a subtype. For example −text/htmlimage/pngapplication/jsonWhen an HTTP message contains an entity-body, the Content-Type header specifies the format of the message body. This tells the receiver how to parse the contents of the message body.When the client sends a request message, it can include an Accept header. The Accept header tells the server which media type(s) the client wants from the server.Accept: text/html, application/xhtml+xml, ... Read More

2K+ Views
Reflection is when managed code can read its own metadata to find assemblies. Essentially, it allows code to inspect other code within the same system. With reflection in C#, we can dynamically create an instance of a type and bind that type to an existing object. Moreover, we can get the type from an existing object and access its properties. When we use attributes in our code, reflection gives us access as it provides objects of Type that describe modules, assemblies, and types.Let us say we have a property of type double and in the runtime we actually have the ... Read More

3K+ Views
A static constructor is used to initialize any static data, or to perform a particular action that needs to be performed once only. It is called automatically before the first instance is created or any static members are referenced.Static constructors are useful when creating wrapper classes for unmanaged code, when the constructor can call the LoadLibrary method. Static constructors are also a convenient place to enforce run-time checks on the type parameter that cannot be checked at compile time via constraints.Static constructors have the following properties −A static constructor does not take access modifiers or have parameters.A class or struct ... Read More