Posts

Showing posts with the label ASP

ASP.NET

  ASP.NET Q1: Diff Transient , Scoped , and Singleton service lifetimes? Transient : Created every time. Good for lightweight, stateless services. Scoped : Created 1/client request (connection). Any API or web request sharing same HTTP context shares exact same instance. Singleton : Only single, identical instance thru app's lifecycle. Q2: State Management 1) ViewState (Client-Side) How : Serializes data into hidden HTML input field ( __VIEWSTATE ). Scope : Single page postbacks. Trade-off : Saves server RAM. Hvy network payloads slow page loads. Legacy (Web Forms). 2) Cookies (Client-Side) How : Text files in browser sent automatically with every HTTP request. Scope : Across requests until expiration. Trade-off : Great for user preferences. Vulnerable to tampering. Max 4KB size. 3) Query Strings (Client-Side) How : Appends key-value pairs to URL end ( ?id=123 ). Scope : Single targeted HTTP r...