Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Global.asa problem

Posted on 2005-03-28
4
Medium Priority
?
366 Views
Last Modified: 2008-03-17


I have a global.asa file (listed below) and want to include the statement....
<!--#include file="..\include\login.asp"-->

How can i include this statement in the .asa file?



My global.asa file......
Script Language="VBScript" RUNAT="Server">

Sub Application_OnStart
Application( "WhosOnline" ) = 0
End Sub

Sub Application_OnEnd
End Sub

Sub Session_OnStart
Dim SQL
Dim rstadd    
Dim LOGON_USER

LOGON_USER = Request.ServerVariables("LOGON_USER")


strSQL = "INSERT INTO UserTable (session_id, username, session_start, status) " & _
            " VALUES (" & Session.SessionID & ",'" & Logon_User & "','" & now & "', '"& "Online"&"')"

Set rstadd = cnnLogin.Execute(strSQL)

End Sub

Sub Session_OnEnd

strSQL2 = "DELETE FROM UserTable WHERE session_id = " & Session.SessionID

Set cnnLogin = Server.CreateObject("ADODB.Connection")
cnnLogin.open "Provider=SQLOLEDB; Data Source = (local); Initial Catalog = HardwareCompatibility; User Id = sa; Password= ccdteam"

Set rstadd = cnnLogin.Execute(strSQL2)

End Sub

</Script>



0
Comment
Question by:SamirKumar
  • 2
4 Comments
 
LVL 9

Expert Comment

by:cb1393
ID: 13643922
Just place it within the appropriate event, if applicable.

Note that you should remove any <% %> tags from login.asp and ensure all of the code in login.asp is VBScript to be executed on the server (per the <Script Language="VBScript" RUNAT="Server"> tag at the beginning of the global.asa file.

Optionally, you can place the include outside of the <Script> tags in the global.asa, but make sure to include the script tags in the login.asp file.
0
 
LVL 15

Expert Comment

by:joeposter649
ID: 13646225
We really need to know more about what you're trying to do.  

You can only use Server and Application objects in the Application_OnStart and Application_OnEnd subroutines.
In the Session_OnEnd subroutine, you can use Server, Application, and Session objects.
In the Session_OnStart subroutine you can use any built-in object.

If I had to guess I'd say you don't want to include login.asp in your global.asa.  You probably want to put a couple lines in the session_onstart that checks a session variable to see if the user is logged in and redirects to login.asp if they aren't.
0
 
LVL 5

Accepted Solution

by:
jkwasson earned 150 total points
ID: 13646435
look at these paq's addresses using an include file in global.asa and see if they help. it will show you how to use an include file in your global.asa
http://www.experts-exchange.com/Web/Web_Languages/ASP/Q_20546666.html?query=include+file+global.asa&clearTAFilter=true

jk
0
 
LVL 9

Expert Comment

by:cb1393
ID: 13701701
Ahh, the power of examples. :-)
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Suggested Courses
Course of the Month11 days, 16 hours left to enroll

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question