在GLOBAL.ASA中创建会话变量??? [英] Creating session variables in GLOBAL.ASA ???

查看:74
本文介绍了在GLOBAL.ASA中创建会话变量???的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿所有


在我的GLOBAL.ASA文件中,我正在尝试创建会话变量以供参考

在我网站的各个网页中....


Sub Session_OnStart

会话(" LoggedOn")=" Y"

End Sub


在我的各种ASP页面上引用Session(LoggedOn)时,它会以"来表示




我显然误解了这是如何工作的...有人能指出

正确的方向吗?


最终我''我需要访问一个数据库,我假设如果我需要

连接到该数据库,我需要在

中创建连接Session_OnStart事件并销毁Session_OnEnd事件中的连接

的GLOBAL.ASA文件。


感谢任何帮助!

Hey all

In my GLOBAL.ASA file I''m trying to create a session variable for reference
in the various webpages of my site....

Sub Session_OnStart
Session("LoggedOn")="Y"
End Sub

When referring to Session("LoggedOn") on my various ASP pages, it is coming
up as "".

I''m obviously misunderstanding how this works... Can anyone point me the
right direction?

Eventually I''ll need to access a database and I''m assuming that if I need to
connect to that database, that I''ll need to create the connection in the
Session_OnStart event and destroy the connection in the Session_OnEnd event
of the GLOBAL.ASA file.

Any help is appreciated!

推荐答案



" RooLoo" <滚装**** @ Loo.Roo>在留言中写道

新闻:lR *********************** @ news3.calgary.shaw。 ca ...

"RooLoo" <Ro****@Loo.Roo> wrote in message
news:lR***********************@news3.calgary.shaw. ca...
嘿所有

在我的GLOBAL.ASA文件中,我正在尝试在我的各种网页中为
引用创建一个会话变量网站....

Sub Session_OnStart
会话(LoggedOn)=" Y"
结束子

当提到会话时(在我的各种ASP页面上的LoggedOn,它是
即将出现为"。


有几点需要注意:


1st:不要多了!!!!


2nd:我认为Session_OnStart应该是Session_OnStart()


第3名:检查global.asa的位置。必须位于

应用程序的根目录中。


第4名:确保您拥有Global.asa文件。如果您正在免费提供

brinkster.com等提供商,您可能不会被允许使用自定义的global.asa文件。


5th:你可能最好把它作为一个布尔值引用。即使

虽然所有的值都存储为变体,但总会有类型转换

问题,你也可能会发现自己在
$中犯了一些小错误b $ b区分大小写,如果你把它存储在一个字符串中。

最后我需要访问一个数据库,我假设如果我需要
连接到那个数据库,我需要在
Session_OnStart事件中创建连接并销毁GLOBAL.ASA文件的Session_OnEnd
事件中的连接。
Hey all

In my GLOBAL.ASA file I''m trying to create a session variable for reference in the various webpages of my site....

Sub Session_OnStart
Session("LoggedOn")="Y"
End Sub

When referring to Session("LoggedOn") on my various ASP pages, it is coming up as "".
A few things to notice:

1st: DON''T MULTIPOST!!!!

2nd: I think "Session_OnStart" should be "Session_OnStart ()"

3rd: Check the location of global.asa. Must reside in the root of your
application.

4th: Make sure you can have a Global.asa file. If you''re hosting on a free
provider like
brinkster.com you''ll probably not be allowed to use custom global.asa files.

5th: You''d probably be better off referencing this as a boolean value. Even
though all values are stored as variants there are always type-casting
issues, also you''ll probably find yourself making niggly little mistakes in
case-sensitivity if you store this in a string.
Eventually I''ll need to access a database and I''m assuming that if I need to connect to that database, that I''ll need to create the connection in the
Session_OnStart event and destroy the connection in the Session_OnEnd event of the GLOBAL.ASA file.



不,你不会: http://www.aspfaq.com/ 2053


问候


马特



No you won''t: http://www.aspfaq.com/2053

Regards

Matt


你确定这个global.asa位于标记为应用程序的文件夹中?如果它不是
,它将使用来自默认webroot或父

应用程序的global.asa。


你确定会议有效吗?
http://www.aspfaq.com/2057


" RooLoo" <滚装**** @ Loo.Roo>在留言中写道

新闻:lR *********************** @ news3.calgary.shaw。 ca ...
Are you sure this global.asa is in a folder marked as an application? If it
isn''t, it will use global.asa from the default webroot or the parent
application.

Are you sure sessions are working?
http://www.aspfaq.com/2057


"RooLoo" <Ro****@Loo.Roo> wrote in message
news:lR***********************@news3.calgary.shaw. ca...
嘿所有

在我的GLOBAL.ASA文件中,我正在尝试在我的各种网页中为
引用创建一个会话变量网站....

Sub Session_OnStart
会话(LoggedOn)=" Y"
结束子

当提到会话时(在我的各种ASP页面上显示LoggedOn,它是
即将出现为"。

我显然误解了这是如何工作的......任何人都可以指出我
正确的方向?

最终我需要访问一个数据库,我假设如果我需要
连接到该数据库,我会需要在
Session_OnStart事件中创建连接并销毁GLOBAL.ASA文件的Session_OnEnd
事件中的连接。

感谢任何帮助!
Hey all

In my GLOBAL.ASA file I''m trying to create a session variable for reference in the various webpages of my site....

Sub Session_OnStart
Session("LoggedOn")="Y"
End Sub

When referring to Session("LoggedOn") on my various ASP pages, it is coming up as "".

I''m obviously misunderstanding how this works... Can anyone point me the
right direction?

Eventually I''ll need to access a database and I''m assuming that if I need to connect to that database, that I''ll need to create the connection in the
Session_OnStart event and destroy the connection in the Session_OnEnd event of the GLOBAL.ASA file.

Any help is appreciated!



我不知道为什么你写的东西不起作用,不过你的数据库是

p aragraph不正确。你不想以这种方式打开连接。你可能想要将连接字符串存储在Session变量中,但是你需要打开和关闭各个页面上的数据库连接。


您的global.asa文件是否位于Web应用程序的根目录中?


" RooLoo" <滚装**** @ Loo.Roo>在留言中写道

新闻:lR *********************** @ news3.calgary.shaw。 ca ...
I don''t see why what you''ve written wouldn''t work, however your database
paragraph is incorrect. You DON''T want to open a connection that way. You
may want to store the connection string in a Session variable, but you
should open and close database connections on the individual pages.

Is your global.asa file in the root of the web application?


"RooLoo" <Ro****@Loo.Roo> wrote in message
news:lR***********************@news3.calgary.shaw. ca...
嘿所有

在我的GLOBAL.ASA文件中,我正在尝试在我的各种网页中为
引用创建一个会话变量网站....

Sub Session_OnStart
会话(LoggedOn)=" Y"
结束子

当提到会话时(在我的各种ASP页面上显示LoggedOn,它是
即将出现为"。

我显然误解了这是如何工作的......任何人都可以指出我
正确的方向?

最终我需要访问一个数据库,我假设如果我需要
连接到该数据库,我会需要在
Session_OnStart事件中创建连接并销毁GLOBAL.ASA文件的Session_OnEnd
事件中的连接。

感谢任何帮助!
Hey all

In my GLOBAL.ASA file I''m trying to create a session variable for reference in the various webpages of my site....

Sub Session_OnStart
Session("LoggedOn")="Y"
End Sub

When referring to Session("LoggedOn") on my various ASP pages, it is coming up as "".

I''m obviously misunderstanding how this works... Can anyone point me the
right direction?

Eventually I''ll need to access a database and I''m assuming that if I need to connect to that database, that I''ll need to create the connection in the
Session_OnStart event and destroy the connection in the Session_OnEnd event of the GLOBAL.ASA file.

Any help is appreciated!



这篇关于在GLOBAL.ASA中创建会话变量???的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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