Include File In Global.asa
I have written general purpose functions in one of the include file, I want
to use the same in the global.asa. Do you know how to use include file in
global.asa
I have written general purpose functions in one of the include file, I want
to use the same in the global.asa. Do you know how to use include file in
global.asa
I have written general purpose functions in an .inc file when I include that file using #include to my global.asa I get errors. whats the correct way to include that .inc file in global.asa.
View Replies View RelatedPossible? It seems nobody knows how...
View Replies View RelatedCan I include the same include files in global.asa that I use in other asp scripts? I haven't been able to make it work. My O'Reilly book says that global.asa can have includes, but the syntax required doesn't seem to be the same as individual .asp scripts.
I want to be able to use the same cleanup code in Session_OnStart and Session_OnEnd that I use from an on-demand script as well (for testing and inspection purposes). Can I do that? If so, can someone provide a fairly detailed skeleton or point me to a page that has this info?
I want to be to call my menu from another file onto my page so that i dont have to add it to every page of my website. The problem is when i try to add it using the include method it says that only one include file is allowed on an ASP. The other include file is my connection string so i cant really take that out of the page because then nothing else will work!
How can i get the menu page included as well as the connecting string?
Have added the code below, i have highlighted the 2 include files that i want to use in blue, i have also left the div tag in for where i currently have the menu which is what i want to take out and have ther include file there instead, if that makes sense. Basically the bit in red i want to be able to remove from all of my pages and add the blue file above the red code in instead, but i dont know how!!!!! Code:
I have an asp page written entirely in jscript with a vbscript used as an include file which one variable on the page must access.
When the page runs, I run into jscript complilation errors when it tries to access the include file (since it is written in vbscript), and I can't figure out how to get the two to work together. How do you get both scripting languages to work on the same page?
I am in much need of some help with my global.asa file. I use ASP and mySQL. In a nutshell, When a registered user logs in, a field in I have a field that gets updated in my DB Table. It is a TINYINT. When they log in, it updates the value to 1, when they log out, it updates it to 0. I use a tiny iFrame to create a loop displaying users with the value of 1. Basically a cheasy "Who's Online" function.
How ever I am now trying to create a global.asa file to say when the session times out, I want the global file to just update the value back to 0. I am also attempting it so that if the users browser window closes and then gets reopened PRIOR to the timeout limit, It knows they are still logged in. I can provide my script if anyone thinks they can help. !!!!!!!!!!!!!!!!!!!
I think my final thought would be that when the user closes their browser, that the session ends and the DB field gets updated from a 1 to a 0.
Users are required to log into my website. I store the users name in a session variable. If the user doesn't log out and the session expires after 20 minutes, is it permissable to have code in the session end function of the global.asa which accesses a database and makes alterations to the users login status?
The reason I ask this is that I am having problems trying to get the logout to work for sessions which have timed out. If the users logout using the logout button, the code works fine.
It seems to me that I generally use two types of Functions:
Type #1-Ones that any page on my site might use
Type #2-Ones that only a single page would ever use
Logically, it seems that I should put the Type #1 functions in the GLOBAL.ASA file and the Type #2 functions in the pages that use them. I would like to, however, just go ahead and include ALL of my functions in the GLOBAL.ASA file.
Comments on this? Is this a good idea?
where does the file need to be?(root directory of server? main directory of my application?)
I don't need to include the global.asa file in my asp pages to reference the application variables, right?
can I use application variables without using a global.asa file?
when using a global.asa file, do I need to restart the server(or IIS) every time I make changes to it, or does the application automaticaly reset once a change has been made to it?
at the mo I have a global.asa file that looks like this.
<script language="vbscript" runat="server">
Sub Application_OnStart
Application("visitors")=0
End Sub
Sub Session_OnStart
Application.Lock
Application("visitors")=Application("visitors")+1
Application.UnLock
End Sub
Sub Session_OnEnd
Application.Lock
Application("visitors")=Application("visitors")-1
Application.UnLock
End Sub
</script>
and then I have this line in the asp page to display the number of visitors...
Code:
response.write(Application("visitors"))
I get nothing...!
what am I missing?
My website is hosted with the ISP and recently I have modified my Global.asa file for the ASP application.
So I think we need to restart the World Wide Web Publishing Service so that the changes in the Global.asa will take effect. I think it will be difficult for the ISP to restart the Service as there many applications will be running. So can you suggest how can my global.asa file changes will take effect so that I can deply those changes?
Can I put a session.timeout = "45" in the global.asa file? and if yes, under what section?
View Replies View RelatedIf I don't set a vritual directory for the new application on the IIS (simpley copy the new application to a parent virtual directory), the new application's Global.asa file won't work. Right?
View Replies View RelatedI am trying to implement a single global text file for my web site that will log the actions that my ASP scripts peform. The site I have set up involves about five web pages with scripting in VBscript. Several of these pages also use COM automation to peform certain tasks in Excel macros which also write to the text file.
Currently, I must declare an FSO object on each page. I also have to close the object before I call the COM components (because I write to the log file from the Excel macros, too) and then open it again when control returns to my ASP scripts.
The macros I have written inside Excel are quite intensive, so they chew up some time when they execute. In the end, each user will go through the five web pages to generate an Excel spreadsheet which they can download, and, during this process, will have logged about 15 messages to the text file. Code:
On each site there is a global.asa file that ties into an Access database. The fields from the Access database instantiate the values of session variables used in the site. I am trying to do away with the need for a database and was wondering if when I set up a site I also set the .asa file for that site.
Then if a shop wants to change something like an address, phone, number, directions, etc., they would go a toolbox area of the site and there would be a form whose field values would be populated by the session variables from the global.asa file.
When the form was submitted I was thinking I could somehow use asp to write a new global.asa file and store it in the server. Is this feasible? Also, what would this mean insofar as permissions on the root directory of the site? I'd imagine they'd have to have write permissions no? Code:
At my site I have designed a framework with tabs as below:
(tabs_1.asp)
+----+ +------+ +-------+
| MC | | Cars | | Boats |
+ +-------------------------
then, into tabs_1.asp I include another page
(tabs_1_2.asp)
--------+ +--------------
| New | | Used | | Crasched |
+-----+ +------+ +----------+
Works fine so far... Here comes the problem...
The file tabs_1_2.asp has an included page (data.asp) witch doesnt appear...
When I look at the sourcecode from the webbrowser it seems to have been included but nothing is visible.
Is it inpossible to make several includes in the way I described?
I have initialized some session variables in Global.asa for our web
application. But these session variables are returning null values; it is was
working fine before; Recently we have rebuild our servers.
Please let me know if anyone of you have some idea?
I have actually an asp web site which use the global.asa file to connect to
the database but for security reason, I want to put username and password
information (or the complete connection string) in a seperate file so only a
special user could read these informations.
I am trying to write a sub that will delete a spreadsheet file created by the web user. THis is the code I have inserted into the global.asa file, but it is not working.
sub Session_OnEnd
'delete the temporary excel spreadsheet
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
objFSO.DeleteFile(Server.mappath("temp/<%=session.sessionid%>.xls"))
Set objFSO = Nothing
end sub
I have made sure that the temp folder has permissions set for the IUSR_machinename account to be able to delete files. I am running IIS 5 on a windows 2000 server.
I am about to begin a web site for a client who wishes the site be in English, German, and Italian. What I am planning on doing is setting up a script in the global asa file that will detect if the users language is set to either it or de and if so, set a session variable to Italian or German, if not, set the session variable to English. In the actual pages themselves, I will use a select or if statement on each section that will have content. The statement's criteria will be the session language variable. I know if I was doing this site for someone who wanted it in 20 languages this may not be practical, but for 3 languages I think I can pull it off. So what's my question you ask? Is my approach sound and practical? If so, can someone show me the snippet of code that would go in my asa file to set the session variable. OH, and also equally important, when this site is spidered by search engines, will Google.com and Google.it and Google.de pick up their respective pages? The spiders have language settings, no? Don't they request pages from a (my) server just like any other request?
View Replies View Relatedi have two sites on shared NT hosting
aw.neue.co.uk and smh.neue.co.uk
both sites have their own global.asa files and both appear to be throwing up an error referring to a file that is in a different location
anyone know whats happening?
I'm wondering if there's any way to include a XML file (with a XSL) in a ASP file? I've tried this <!--#include file="publications.xml"--> but the XML-code is included before it is formated according to the XSL and ends up being unformated.
View Replies View Relatedhow would i get something like this to work...
<!-- #include file="<%=Request.GetString("view")%>.txt" -->
i know wat i want and all but i can't figure out how to make it work.
I want to include files, a header and a footer to my asp page. The files i want to include its on another server, i can reach it with a www-url. Can i use the www-url to include the file to asp page?
View Replies View RelatedHow can I include a .cgi file in an .ASP file?
I've tried #include, Server.Transfer, and Server.Execute (yes, I know the last two are
only for ASP, but I tried it anyway).
If I have to, I guess I'll use ASPHTTP to do an http call to the file but first I wanted
to see if there was a more elegant way to do it
Is there an efficient way to include the output of a .cgi file in an ASP file?
Is there any way of having an include file as a string, eg:
<!--#include file="<%=strURL%>"-->
This doesn't seem to work, I get an error:
The include file '<%=strURL%>' was not found
Is my syntax wrong or isn't this possible?
<%
If rsResult.fields(3).value = "" Then
Response.Write "No File Available</td>"
Else
%>
<!-- #include file="Response.Write rsResult.fields(3).value" -->
<%
End If
%>
I do almost exclusively ASP on IIS, so I'm stupid when it comes to dealing with flat HTML on Linux/Apache.I have a static site on a Linux box where I want to do an include on an ASP file on an IIS box, and can't make it work.
I've tried <!--#include virtual="http://where.com/abc.asp"-->
and <!--#include virtual="http://where.com/abc.txt"-->
The ".txt" extension try was in case it's true what I heard that IIS won't let a remote server execute an ASP in an include file.
Also tried <!--#include file=...", even though I know from experience that Apache requires "virtual," not "file."
And also tried <!--#exec cgi=...".
NOT drawing any errors: the generated output just repeats the "<!--#include..." line instead of outputting results from the ASP file.
I want to execute another asp file at the end of my asp file.. How will I do that ?
View Replies View RelatedI use include files a lot in ASP, but I was wondering if these files aren't actually part of ASP at all and you can use them in other web-based files.
View Replies View Relatedhow can i add include file that isnt in my directory i need to add a file called:
http://mpfile.hollosite.com/pafile/pafiledb.php
Trying to use a include file in an if statement and it is not working,I have tried it multiple ways and have keep getting errors or blank where it should be.
Code:
<%
IF session("sessionID") = "" THEN
Response.write (" <!--#INCLUDE file=""loginHeader.asp""--> ")
ELSE
Response.write (" <!--#INCLUDE file=""loggedinHeader.asp""--> ")
END IF
%>
How to include file into an ASP program? I was trying with this command:
<!-#include file="INC_file.asp" ->
but unfortunately it does not work but isn't any error message.IIS server shows primary site,but without informations from incuded file.How can I make it works?