1. Techniques for Generating Tokens
* JWT (JSON Web Token) – Common in Web API, contains claims, digitally signed.
* OAuth2 Access Tokens – Generated via authentication servers (e.g., IdentityServer).
* GUID Tokens – Random unique IDs for session/transaction purposes.
* Refresh Tokens – Long-lived tokens to get new access tokens.
* Encrypted Tokens – Using symmetric/asymmetric encryption.
Fastest: Usually JWT is faster for stateless APIs because no DB lookup is needed once issued.
---
2. DB First vs Code First (Entity Framework)
* DB First – Start from an existing DB → generate model from DB schema.
* Code First – Start from C# classes → EF generates DB schema.
Which is faster?
* Development Speed: DB First is quicker if DB already exists.
* Flexibility/Maintenance: Code First is better for iterative development.
---
3. Bundle Config & CDN
* Bundle Config – Combines and minifies multiple JS/CSS files into one bundle for fewer HTTP requests.
* CDN (Content Delivery Network) – Hosts static files across global servers to serve them faster to users.
Which is better?
* Use both: CDN for delivery speed, Bundle for minimizing HTTP requests.
---
4. Application Object vs Session Object
* Application Object – Global data shared across all users in the application.
* Session Object – Data stored per user session.
Difference: Application is global, Session is user-specific.
---
5. Abstract Class vs Interface
* Abstract Class – Can have implemented & abstract methods, fields, constructors.
* Interface – Only method/property/event signatures, no implementation (until default methods in C# 8+).
Key Difference: Abstract class supports inheritance with shared code; interface is a contract only.
---
6. IIS Request Processing
1. Request hits HTTP.sys (kernel mode listener).
2. Passes to IIS Worker Process (w3wp.exe).
3. Request pipeline executes modules/handlers.
4. ASP.NET runtime processes request.
5. Response sent back to client.
---
7. Status Codes
* 200 OK – Successful request.
* 403 Forbidden – Request understood but denied (permissions).
* 500 Internal Server Error – Server error.
---
8. What is Render
* In ASP.NET MVC: `RenderBody`, `RenderSection`, `RenderPartial` methods output HTML to response.
* In general: Process of generating and sending the final output to browser.
---
9. Web API Testing Techniques
* Manual Testing (Postman, Swagger).
* Unit Testing (NUnit, xUnit).
* Integration Testing.
* Automated UI + API Tests (Selenium + API tests).
---
10. Difference: Web API vs WCF
* Web API – REST, lightweight, works over HTTP only, supports JSON/XML.
* WCF – SOAP, supports multiple protocols (HTTP, TCP, MSMQ), more configuration-heavy.
---
11. Without Try Block Exception Handling
* Global.asax `Application_Error` event.
* Custom Middleware in .NET Core.
* Exception Filters (`IExceptionFilter`).
---
12. Verbs in Web API
* GET – Retrieve.
* POST – Create.
* PUT – Update (replace).
* PATCH – Update (partial).
* DELETE – Remove.
* HEAD/OPTIONS – Metadata & pre-flight.
---
13. Contracts
* A contract defines the shape of communication between service & client in WCF.
---
14. Service Contract vs Message Contract
* Service Contract – Methods & operations exposed by service.
* Message Contract – Defines custom SOAP message structure.
---
15. SOLID Principles
1. S – Single Responsibility.
2. O – Open/Closed.
3. L – Liskov Substitution.
4. I – Interface Segregation.
5. D – Dependency Inversion.
1. **S — Single Responsibility Principle (SRP)**
* A class/module should have only **one reason to change** — meaning it should do **one thing well**.
2. **O — Open/Closed Principle (OCP)**
* Code should be **open for extension but closed for modification**, allowing you to add features without altering existing, tested code.
3. **L — Liskov Substitution Principle (LSP)**
* Subclasses should be **replaceable for their base classes** without breaking functionality.
4. **I — Interface Segregation Principle (ISP)**
* Prefer many **small, specific interfaces** over one large, general-purpose interface to avoid forcing classes to implement things they don’t need.
5. **D — Dependency Inversion Principle (DIP)**
* Depend on **abstractions, not concrete implementations**, so code is loosely coupled and more maintainable.
---
16. Install Certificates in IIS
1. Open IIS → Server Certificates.
2. Import certificate (.pfx/.cer).
3. Bind it to HTTPS site in Bindings.
---
17. Passport Authentication
* Microsoft’s old identity system.
* Redirects to passport.net, authenticates, returns ticket to site.
---
18. Difference: Web Service vs WCF
* Web Service – SOAP over HTTP, only XML.
* WCF – Supports SOAP + multiple protocols, flexible serialization.
---
19. Web API Token Types
* Bearer Tokens (JWT).
* OAuth Access Tokens.
* Refresh Tokens.
* Hawk/MAC Tokens (less common).
---
20. Where Configure Endpoints in WCF
* `web.config` or `app.config` under `<system.serviceModel><services>`.
---
21. Difference XML vs JSON
* XML – Verbose, supports attributes, tags, schema validation.
* JSON – Lightweight, easier to parse, widely used in REST.
---
22. Bundle Config vs CDN – Which Better
* CDN – Better for public libraries (fast load globally).
* Bundle Config – Better for your own site scripts to reduce requests.
* Best: Use both.
No comments:
Post a Comment