Reputation: 3924
I was asked a question what is mean by httpruntime and difference between httpruntime and httpmodules in an interview
I tried understanding that and got these link
Still i couldn't get that. Can someone give a kind of simple definition to know what it is.
I am new to asp.net please help me.
Upvotes: 1
Views: 4843
Reputation: 7462
As per MSDN
HttpRuntime class—the entry point in the pipeline. The HttpRuntime object initializes a number of internal objects that will help carry the request out. The HttpRuntime creates the context for the request and fills it up with any HTTP information specific to the request. The context is represented by an instance of the HttpContext class.
An HTTP module is an assembly that is called on every request made to your application. HTTP modules are called as part of the ASP.NET request pipeline and have access to life cycle events throughout the request. HTTP modules therefore give you the opportunity to examine incoming requests and take action based on the request. They also give you the opportunity to examine the outbound response and modify it.
tl;dr - HttpRuntime is responsible to managing request via spawning object and carry response to end user whereas HttpModule is a way to intercept request pipeline/events for each of request.
Upvotes: 2