Friday, September 19, 2008

BCS Cookie Class For .NET

There are modern times when cookies will be used to go through values between stateless .NET active waiter pages. Session variables can be used in certain cases but typically cookies are used for this degree of activities.

A social class for handling cookies utilizes the followers .NET System.Web and System.Web.UI units. The two blocks of codification expose all the necessary places to successfully pull strings .NET cookies.

The overall social class instantiates an physical object of UserControl and its name is TCook. Three methods are employed to execute the heavy lifting and they are DelCook, GetCook and SetCook. DelCook and SetCook are processes while GetCook is a mathematical function that tax returns the value of the cooky as requested by the user.

In either lawsuit the TCook social class must be created before any of the methods are utilized. As a general pattern when processing is completed the TCook instantiation is de-allocated via the Free method. The free method release all allocated resources and tax returns control to the end user.

Once the TCook social class is instantiated the processing can begin. First we will reexamine the SetCook procedure. As the name connotes this process is used to put the designated cooky to a specific value. Parameters passed to the process are HttpResponse, cname, cval. HttpResponse is the active Hypertext Transfer Protocol application thread. The cname parametric quantity places the cooky name. The cval parametric quantity places the value to be assigned to the cooky name. Upon successful executing of the SetCook process a cooky is created for the application containing the value base on balls through the cval parameter.

The GetCook mathematical function tax returns the value of a previously assigned cooky using the GetCook procedure. There are two parametric quantities passed to the GetCook parametric quantity and they are HttpRequest and cname. HttpRequest is the active Hypertext Transfer Protocol petition yarn and the cname is the name of the cooky stored.

The DelCook process deletes the cooky identified by its name. There are modern times when we necessitate to cancel cookies to accomplish the desired functionality for the application.

By incorporating the use of these processes and mathematical mathematical mathematical functions all necessitate cooky use are achieved within one social class and is reusable in numerous applications.

This attack compartmentalizes the functions and written documents the most utile functions used when cooky use is required.

Please feel free to reach me at my web land site below for additional aid in this as well as other endeavors. Simply chink on the free audience nexus at the top of every active page on the web site.

No comments: