What is HTTPContext and HTTPModule. What is the use of them?

Answer Posted / kk

HttpModule handles a application related events and
httpmodule serve the same purpose as does by ISAPi filter
for primitive ASP.Httpmodule by default have following
feature to support
Output Caching
Session State
Windows Authentication
Forms Authentication
Passport Authentication
Role Manager
URL Authorization
File Authorization
Anonymous Identification
Profile
One can make custome httpmodule and can place in web.config
so that at runtime it can process the chain of request as
and when comes .This can be identify through extension based
processing files.For an e.g there is custom class which when
invoke render charts as per the data input.This basically
can be wrapped in httpModule for processing and rendering
the class object at runtime.

HttpContext: This belongs to System.Web,this actually the
best way to read server response at runtime.

1)For example there is property and one want to get and set
the value of property that can easily be achieved through
httpcontext.

((CustomerClass)HttpContext.Current.Item).CustomerIDProperty=78;

2)similarly one can store the current context in collection
format.

HttpContext.Current.Items.Add("ERROR_MSG", exception.Message);
3) Can do server.transfer
HttpContext.Current.Server.Transfer("~/CriticalException.aspx",
false);
www.brainbell.com/tutorials/ASP/HttpModules.html

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

When using the Pager object, inorder to know which page to go, which property you have to set to grid?

647


What is active web page?

641


What is viewstategenerator?

819


Contrast oop and soa. What are tenets of each16. How does the xmlserializer work? What acl permissions does a process using it require?

600


What is another word for redirect?

591






What is sdlc process?

612


What are ASHX files?

684


What is preprocessor in .net and type, where it use?

750


What are main return types supported in Web API?

846


In Data grid the question is below quantity price total these are 3 fields available in data grid if you enter quantity the total has to update automatically.Price field is already filled completely

1650


Can you explain how ASP.NET application life cycle and page life cycle events fire?

669


How to handle errors in Web API?

735


Explain the difference between or and orelse?

621


Do you know about caching with the datasource controls?

560


Why do we need Sessions?

664