OutFront Forums
     Home    Register     Search      Help      Login    

Sponsors
Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax
Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.
Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Follow Us
On Facebook
On Twitter
RSS
Via Email

Recent Posts
Todays Posts
Most Active posts
Posts since last visit
My Recent Posts
Mark posts read

 

"#include" files and global.asa

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> General Web Development >> "#include" files and global.asa
Page: [1]
 
 
raygberg

 

Posts: 2
Joined: 8/30/2004
Status: offline

 
"#include" files and global.asa - 8/31/2004 11:15:18   
Here is a very basic question. I've seen conflicting info on whether "#include" commands can be put in global.asa. I need to know for an application I am working on. Can you use the "#include" command in global.asa?

Thanks for any replies!

Ray Greenberg
Spooky

 

Posts: 26723
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: "#include" files and global.asa - 8/31/2004 15:40:36   
What are you trying to include?
SSI are most useful at page level - the global.asa file should only contain application specific programing

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

Sp:)ky


(in reply to raygberg)
raygberg

 

Posts: 2
Joined: 8/30/2004
Status: offline

 
RE: "#include" files and global.asa - 9/1/2004 13:59:15   
quote:

ORIGINAL: Spooky

What are you trying to include?
SSI are most useful at page level - the global.asa file should only contain application specific programing


I am trying to include an ASP connection string to a SQL Server table. In my application, I have all of my SQL connection strings in #include files, because they contain passwords and I want to separate any strings containing passwords from the main ASP code.

The #include file would contain the following:

<%
Set objODB = Server.CreateObject("ADODB.Connection")
objODB.Open "DSN=dsnname;uid=userid;PWD=password;database=dbname"
%>

The reason I am trying to do this is that I don't want to explicitly put a password in the global.asa file due to security concerns.

By way of explanation, what I am trying to do is use the Session_OnEnd subroutine of global.asa as part of a process to track whether users are logged into my application. Each registered user has his/her own SQL record, with a field called "LoggedIn". When each user logs in, the "LoggedIn" field will be set to a value. What I am trying to do is, on session abandonment or expiration, have the Session_OnEnd subroutine in global.asa access the user's SQL record and reset the "LoggedIn" field to null to indicate that the user has logged off. To do this, I must open the SQL database and access the table of user records from the global.asa file.

I know that this is a simplistic way of tracking user logins, but I am somewhat of a newbie at advanced ASP programming and this was the best solution I could come up with in the limited time available to me.

Thanks in advance for any replies/suggestions.

Ray Greenberg

(in reply to Spooky)
Spooky

 

Posts: 26723
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: "#include" files and global.asa - 9/1/2004 15:58:04   
Best to use this in global.asa :

Sub Application_OnStart
Application("Connection") = "DSN=dsnname;uid=userid;PWD=password;database=dbname"

Then, in your script :

<%
Set objODB = Server.CreateObject("ADODB.Connection")
objODB.Open Application("Connection")
%>

There used to be an issue with global.asa security which has been fixed, however if you dont want to use that file, my preference would be to use an include file at the top of each connection page

eg :
<!--#include virtual="/conn.asp" -->

<%Conn = "DSN=dsnname;uid=userid;PWD=password;database=dbname"%>

Then, in script use :

<%
Set objODB = Server.CreateObject("ADODB.Connection")
objODB.Open Conn
%>

As far as using OnEnd - dont.
It cant be relied on and in fact never has worked as expected. To timeout a user, you can only run an SQL update to 'logout' users that havent been active for 'x' minutes.

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

Sp:)ky


(in reply to raygberg)
cemeesti

 

Posts: 1
Joined: 10/4/2004
Status: offline

 
RE: "#include" files and global.asa - 10/4/2004 4:31:01   
here is the very basic answer to your question:

<script language="vbscript" runat="server" src="include/yourfile.asp"></script>

have fun with that new include method

(in reply to raygberg)
Page:   [1]

All Forums >> Web Development >> General Web Development >> "#include" files and global.asa
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts