在GLOBAL.ASA中创建会话变量???

编程入门 行业动态 更新时间:2024-10-28 14:24:00
本文介绍了在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等提供商,您可能不会被允许使用自定义的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 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.

不,你不会: www.aspfaq/ 2053 问候 马特

No you won''t: www.aspfaq/2053 Regards Matt

你确定这个global.asa位于标记为应用程序的文件夹中?如果它不是,它将使用来自默认webroot或父 应用程序的global.asa。 你确定会议有效吗? www.aspfaq/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? www.aspfaq/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中创建会话变量???

本文发布于:2023-10-30 08:19:20,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1542293.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:变量   GLOBAL   ASA

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!