re:
!> But is it a good practice to declare our own class of session insteads of
!> using the system one? In my opinion, own session class is more easy to manage
!> and no time-out issue.
There's no problem at all with using your own version of Session,
instead of the built-in one, as long as you know what you're doing.
Just place your class file ( *.cs or *.vb ) in the App_Code directory of your app,
and it will be automatically compiled, or manually compile an assembly
from your class file and place it in the /bin directory of your app.
Juan T. Llibre, asp.net MVP
asp.net faq :
http://asp.net.do/faq/
foros de asp.net, en español :
http://asp.net.do/foros/
======================================
"chowchho" <> wrote in message
news:CC6C2FEE-6BA7-42F5-B5D6-...
> Thank for your explanation.
> But is it a good practice to declare our own class of session insteads of
> using the system one? In my opinion, own session class is more easy to manage
> and no time-out issue.
>
> Thank.
>
> "Aidy" wrote:
>
>> Asp.net gives you a built-in object called Session that lets you store
>> whatever you want in it;
>>
>> Session["UserID"] = 123;
>> Session["Username"] = "Hello";
>> User user = new User();
>> Session["UserObject"] = user;
>>
>> So you could create your own MySession class and just store it in the
>> Session object;
>>
>> MySession s = new MySession();
>> Session["SessionObject"] = s;
>>
>> then retrieve it like this;
>>
>> MySession s = (MySession) Session["SessionObject"];
>>
>> If you look at the global.asax page you can code up a Session start event,
>> this is fired when the user first visits your site and this is where you
>> would instantiate the object and store it in the Session;
>>
>> void Session_Start(object sender, EventArgs e)
>> {
>> ... code here
>> }
>>
>> "chowchho" <> wrote in message
>> news:4219AFC3-A255-4838-B716-...
>> >I am new to ASP.NET and most of my time spending on windows application. In
>> > my Windows application, I used to create a class called MySession and and
>> > instantiate it at the first page and pass around from form to form.
>> >
>> > My quesitons are:
>> > 1) Does this concept same with the Session in ASP.NET?
>> > 2) Can I use the MySession method in ASP.NET?
>> > 3) Wht's the benefit of Session over own-declared session class?
>> >
>> > Thank all.
>> >
>> >
>> > Regards,
>> > Chow
>> >
>>
>>
>>