class -session变量 [英] class -session variable

查看:127
本文介绍了class -session变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想用这种方式做事:


我有一堆东西,我想跟踪用户是

连接到该网站。也许50个小信息。


所以我知道我可以制作50个会话变量,或者在一个

会话变量中存储一个数组,但是我是什么想做的就是将它全部存放在一个类中

所以我可以使用属性get和属性let。


我想将这个类存储在一个会话变量中每次页面更改时我都不会丢失我的信息




好​​主意与否?

解决方案

为什么不将信息存储在数据库中,所有必须存储在

会话中的是主键...


< fe ** @ fro.com>在消息中写道

news:eU ************** @ TK2MSFTNGP12.phx.gbl ...

我想以这种方式做事:

当用户连接到网站时,我想要跟踪一些东西。也许50个小信息。

所以我知道我可以制作50个会话变量,或者在一个
会话变量中存储一个数组,但我想要做的就是将它存储在一个class
所以我可以使用属性获取和属性let。

我想将这个类存储在一个会话变量中,所以我不会丢失我的信息
每次页面是改变了。

好主意与否?



>您仍然需要存储类实例在会话变量中。

这就是我想做的事情。我只想问是否有可能。我想它一定要好b / b $ b b谢谢。所以我会这样做。

如果您从每个页面的DB
获得它,您的用户仍然可以在您的网站周围徘徊。

我不想那样做,我已经这么做了多年。必须是一个更好的方式


谢谢

" Bob Lehmann" <无**** @ dontbotherme.zzz>在消息中写道

news:e7 **************** @ TK2MSFTNGP12.phx.gbl ...你仍然需要将类实例存储在一个会话变量。
如果您只是从每个页面的数据库中获取它,您的用户仍然可以在您的网站上发挥作用。

Bob Lehmann

" Tammy B. < Tb@stinkylips.com>在消息中写道
新闻:%2 **************** @ tk2msftngp13.phx.gbl ...

嗨我正在存储大量的数据库中的信息。
它全部在数据库中。我只想获取一次信息,让
用户

在网站周围不再需要在每个页面上重新查找。

我可以将它全部存储在会话变量中,但是


在包含文件中编写

类似乎更好,并使用属性let和属性设置为
检索我需要的东西。

你以前见过这个吗?

Aaron Bertrand - MVP < AA *** @ TRASHaspfaq.com>在消息中写道
新闻:好的**************** @ tk2msftngp13.phx.gbl ...

为什么不存储数据库中的信息,以及所有你必须在

session中存储
是主键...

< fe ** @ fro.com>在消息中写道
新闻:eU ************** @ TK2MSFTNGP12.phx.gbl ...
>
>我想这样做:
>
>我有一堆我想跟踪的东西,而用户是
>连接到网站。也许50个小信息。
>
>所以我知道我可以制作50个会话变量,或者存储一个数组



a>会话变量,但我想做的是将它们存储在一个类中
>所以我可以使用物业获取和物业让。
>
>我想将这个类存储在一个会话变量中,所以我不会丢失我的


info>每次页面更改。
>
>好主意?
>
>





>您仍然需要将类实例存储在会话变量中。

如果您只是从每个页面的数据库中获取它,您的用户仍然可以在您的网站周围徘徊。




我认为使用数据库几乎肯定会更有效率,因为

正确索引和清理过时数据......


Hi,
I want to do things this way:

I have a bunch of stuff that I want to keep track of while a user is
connected to the site. Maybe 50 little peices of information.

So I know I can make 50 session variables , or an store an array in a
session variable, but what I wanna do is store it all in a class
so I can use property get and property let.

I want to store this class in a session variable so I don''t lose my info
everytime the page is changed.

Good Idea or not??

解决方案

Why don''t you store the info in a database, and all you have to store in the
session is the primary key...

<fe**@fro.com> wrote in message
news:eU**************@TK2MSFTNGP12.phx.gbl...

Hi,
I want to do things this way:

I have a bunch of stuff that I want to keep track of while a user is
connected to the site. Maybe 50 little peices of information.

So I know I can make 50 session variables , or an store an array in a
session variable, but what I wanna do is store it all in a class
so I can use property get and property let.

I want to store this class in a session variable so I don''t lose my info
everytime the page is changed.

Good Idea or not??



>You would still have to store the class instance in a session variable .
That'';s what I wanna do. I am just asking is it possible. I guess it must
be thanks. So I''ll do it.

Your users can still whiz around your site if you just get it from the DB each page.

I don''t wanna do that, I''ve done that for years. gotta be a better way

thanks
"Bob Lehmann" <no****@dontbotherme.zzz> wrote in message
news:e7****************@TK2MSFTNGP12.phx.gbl... You would still have to store the class instance in a session variable .
Your users can still whiz around your site if you just get it from the DB
each page.

Bob Lehmann

"Tammy B." <Tb@stinkylips.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...

Hi I am storing tons of info in a database.
It''s all in a database. I just want to get the info once and let the user

whiz around the site with out having to look it up again on every page.

I could store it all in session varables, but it seems even better to


write

a class in an include file, and use property let and property set to
retrieve what I need.

Have you seen this before?

"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
news:OK****************@tk2msftngp13.phx.gbl...

Why don''t you store the info in a database, and all you have to store in

the

session is the primary key...

<fe**@fro.com> wrote in message
news:eU**************@TK2MSFTNGP12.phx.gbl...
> Hi,
> I want to do things this way:
>
> I have a bunch of stuff that I want to keep track of while a user is
> connected to the site. Maybe 50 little peices of information.
>
> So I know I can make 50 session variables , or an store an array in


a > session variable, but what I wanna do is store it all in a class
> so I can use property get and property let.
>
> I want to store this class in a session variable so I don''t lose my


info > everytime the page is changed.
>
> Good Idea or not??
>
>





> You would still have to store the class instance in a session variable .

Your users can still whiz around your site if you just get it from the DB
each page.



And I contend that using the DB would almost surely be more efficient, given
correct indexing and cleanup of obsolete data...


这篇关于class -session变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆