?
Solved

Global.asa problem

Posted on 2005-03-28
4
Medium Priority
?
359 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
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 is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

752 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