Help understanding httpContext

  • Thread starter Thread starter Scooby Dog
  • Start date Start date
S

Scooby Dog

Could someone help me with the following:

I have been reading (learning asp.net) the book ASP.net 3.5 for dummies.
In the book chp18 to be exact the author uses HttpContext.Current.profile
and casts that to a ProfileCommon. I understand PostBack and session
Variables, viewstate, and hidden fields but what is 'HttpContext, and
ProfileCommon'. Is HttpContext like some master session thing that both
keeps track of user info ie: ip, login etc and allows you to store data with
in it. Is ProfileCommon a way to write serialized data ie: objects to xml
files or sql databases.

Dim pfile As ProfileCommon

pfile = CType(HttpContext.Current.Profile, ProfileCommon)

pfile.ShoppingCart = New ShoppingCart ' ShoppingCart is a serialized class
with a List(Of cartitems)
pfile.Save()

*********************web.config entry*********************
<profile enabled="true" defaultProvider="AspNetSqlProfileProvider">
<properties>
<add name="ShoppingCart" type="ShoppingCart"
serializeAs="Xml" allowAnonymous="true"/>
</properties>
</profile>
******************************************************



Thanks

Dave
 
Could someone help me with the following:

    I have been reading (learning asp.net) the book ASP.net 3.5 for dummies.
In the book chp18 to be exact the author uses HttpContext.Current.profile
and casts that to a ProfileCommon.  I understand PostBack and session
Variables, viewstate, and hidden fields but what is 'HttpContext, and
ProfileCommon'.  Is HttpContext like some master session thing that both
keeps track of user info ie: ip, login etc and allows you to store data with
in it.  Is ProfileCommon a way to write serialized data ie: objects to xml
files or sql databases.

Dim pfile As ProfileCommon

pfile = CType(HttpContext.Current.Profile, ProfileCommon)

pfile.ShoppingCart = New ShoppingCart ' ShoppingCart is a serialized class
with a List(Of cartitems)
pfile.Save()

*********************web.config entry*********************
<profile enabled="true" defaultProvider="AspNetSqlProfileProvider">
<properties>
<add name="ShoppingCart" type="ShoppingCart"
serializeAs="Xml" allowAnonymous="true"/>
</properties>
</profile>
******************************************************

Thanks

Dave

Dave,

By definition "HttpContext is a class that encapsulates all HTTP-
specific information about an individual Http Request". An HttpContext
object is created when a request is made by user in the browser.

http://msdn.microsoft.com/en-us/library/system.web.httpcontext.aspx

HttpContext includes Application (HttpApplication class) and Session
(HttpSession class) where you can store data.

ProfileCommon is a class which includes properties created from the
profile property definitions specified in the web.config file. More
about ProfileCommon at http://msdn.microsoft.com/en-us/library/2y3fs9xs.aspx

or http://www.odetocode.com/articles/440.aspx

Hope this helps,
 
Could someone help me with the following:

    I have been reading (learning asp.net) the book ASP.net 3.5 for dummies.
In the book chp18 to be exact the author uses HttpContext.Current.profile
and casts that to a ProfileCommon.  I understand PostBack and session
Variables, viewstate, and hidden fields but what is 'HttpContext, and
ProfileCommon'.  Is HttpContext like some master session thing that both
keeps track of user info ie: ip, login etc and allows you to store data with
in it.  Is ProfileCommon a way to write serialized data ie: objects to xml
files or sql databases.

Dim pfile As ProfileCommon

pfile = CType(HttpContext.Current.Profile, ProfileCommon)

pfile.ShoppingCart = New ShoppingCart ' ShoppingCart is a serialized class
with a List(Of cartitems)
pfile.Save()

*********************web.config entry*********************
<profile enabled="true" defaultProvider="AspNetSqlProfileProvider">
<properties>
<add name="ShoppingCart" type="ShoppingCart"
serializeAs="Xml" allowAnonymous="true"/>
</properties>
</profile>
******************************************************

Thanks

Dave

Dave,

By definition "HttpContext is a class that encapsulates all HTTP-
specific information about an individual Http Request". An HttpContext
object is created when a request is made by user in the browser.

http://msdn.microsoft.com/en-us/library/system.web.httpcontext.aspx

HttpContext includes Application (HttpApplication class) and Session
(HttpSession class) where you can store data.

ProfileCommon is a class which includes properties created from the
profile property definitions specified in the web.config file. More
about ProfileCommon at http://msdn.microsoft.com/en-us/library/2y3fs9xs.aspx

or http://www.odetocode.com/articles/440.aspx

Hope this helps,
 
Back
Top