Global.asa :: Not Session_OnStart(), Not Typelib Declarations
I have one IIS 6 machine that seems to ignore global.asa completely. I can't get *anything* to fire -- not Session_OnStart(), not typelib declarations. This is true in the web root as well as in any application folder.
In particular, this is preventing me from loading the ADO 2.8 type library,but I cannot even force an error by using a malformed GUID.This is my only machine that appears to have this problem.
Do I need to do a Application_onstart first then i can do Session_onstart?? or it doesnt matter which one is used b4 which one? When i use a global.asa, do i need to call it within my asp page to execute it or will it be auto started and execute?
i just started learning what it can do, and I am using it to tracj how many people have logged into my site, but when people login to my site, I start 2 sessions, one for their ID, and one for their name. Is there any way to only count the name session as a session_onstart in global.asa?
In Global.asa I have mentioned two sub routines 1> Session_OnStart and 2>Application on Start but both of them are not at all initiated when I restart IIS.
Please Tell me why is this happening, I have tried ever ....
In my Session_OnStart in Global.asa, I am setting some cookies. One of them, I set as follows:
dim UserID UserID = Request.ServerVariables("LOGON_USER") Response.Cookies("User")("ID") = UCASE(UserID)
When I immediately log the cookie value retrieved from Request.Cookies("User")("ID") into the Windows Event Log, I get the correct value. However, when I try to retrieve the cookie on the home page of my application using the same code,
Request.Cookies("User")("ID"), it either cannot find the cookie or cannot read the value. I am retrieving the cookie before all HTML headers are written. It is my first statement on the page after Option Explicit. I have even compared the session IDs. The SessionID created in the Session_OnStart is the same value as the SessionID on the home page.
I have read that the Session_OnStart only has access to the Application, Session and Request objects. It does not explicitly say that it does not have access to the Response object. Also, I was even able to use Response.Write's in Global.asa to print out the values although it looked like it had also stopped the session after I did so. Cookies are definitely enabled on my machine. I have even tried setting the session cookie's expiration to be persistent for a few days to see if it was perhaps expiring before I was able to read it but this did not work either.
Is there something preventing cookies to be created in Global.asa in the Session_OnStart sub? Is the Response object not available??? Please let me know if anyone else has had this problem or solution.
This is a standard ASP application that has several pages at the root withthe global.asa. I set a session variable session("accountid") = "123456" within an asp page and then response.redirect to the next page and immediately response.write session("accountid") and I get back nothing.
But if I set a session variable session("accountid") = "123456" within an asp page and response.redirect to a page in a sub directory and immediately response.write session("accountid") I get back 123456 on the screen.
I use following code in an ASP page to generate a GUID:
<% dim obj Set obj = Server.CreateObject("Scriptlet.TypeLib") Response.Write(obj.guid) Set obj = nothing
%>
It worked fine on my WIN2000 computer running IIS. I recently bought a new computer with XP Pro and this page times out. I now it is the call to obj.guid. I have seen the same behaviour on another XP machine as well.
The funny thing is if I paste this code into VB and display the guid in a message box, it runs without a problem.
I've created a web application with Visual Interdev and I've added Microsoft XML, version 4 in project's references. A META tag has been successfully added in global.asa:
The "Session_OnStart" event doesnot fire if the website has .htm file as the startup document. If I change the extension of the default document from ..htm to .asp then I can see the event fires, But now I cant change the default page to .asp.
How can I make the Session_OnStart fire in that situation?
I have one application folder containing all ASP code files. I want host multiple sites pointing to same code. Can I do this ? If YES then how I can assign diffrent global.asa to each application...
When I set a cookie in global.asa in the sub session_onstart, even if I have "privacy" in IE 6.X set to "block all cookies" the cookie is still set, and I can get it on other pages.
I can't find an article that addresses this as a specific issue. Why does the browser get the cookie when it is set in the session_onstart event even when I have "block all cookies" set?
I am trying to put a condition in my Global.asa file based on the server name.the reason, I want to set a global string as a application variable based on the server I am on. I also need to set a coonection string based on the value of the server. I need to use this connection string to retrieve values from an sp in application on start that sets a load of global variables so I can't really do this anywhere else.
I have a site which until this morning, was on a remote server. The structure was that the "site" was actually a folder on the server, as I am designer and use this arrangement to develop sites. Under the root directory, I had modified the global asa file to include session variables. Ok, so I download the site (folder) to my hard drive, and put it in the folder of "MY Documents" called MyWebs. I then opened VB Studio and created a new solution, which is pointing to the before mentioned directory in My Documents. When I pull the site up in IE, the session variables were not being called, and I realized I had not copied over the asa file. So I did so, placing a copy of it in the hard drive's c inetpub wwwroot directory, and also directly in the my docs mywebs directory,and the site's directory as well. It seems it is still not being called.Can anyone tell me what I am doing wrong?
I have IIS 5.0 installed on for a test server. the global.asa file runs perfectly.
when tryng the same application on win server 2003 IIS 6.0 the global.asa does not fire. i have set the application as a virtual site and given rights for iwam and iusr. What else could be the problem. Code:
How does IIS 6.0 treat the global.asa file? I had the following problem;
1. uploaded a new site to the win3k server
2. had incorrect db connection string in Session_OnStart in global.asa and website caused errors.
3. Changed the global.asa file to include the correct details. Saved the file. Still got the same errors.
I could not resolve this unless restarting the WWW Service on this server. In IIS 5.0 the global.asa file would reload after resaving it (as the timestamp is updated).
I even waited the next day before restarting the service because I though Session_OnStart expires after my session ends...but the error was still there in the morning.
Hopefully someone will make sense of it for me. Here is the code (I inherited) in the global.asa
Sub Application_OnStart Application("DB.ConnectionString")= "" Application("MaxLoginAttempts") = 5 Set Application("Con") = Server.CreateObject("ADODB.Connection") Session("Test") = Now() End Sub
I created a dll to track our users and I want to call it in the Global.asa. How do I do this? I've seen the <OBJECT> tag to create an object, but I'm not sure how to use it correctly.
i'm a little bit confused with using application_onstart.. as u can see in the following code... my DB connection and SQL statements is currently included in my application_onstart event.. but, unfortunately, i wasn't able to reference Application("sUser") in my asp when i tried to run my website Code:
We have over 100 asp pages that reference a table (distribution_components). We added a new column and primary key to that table, so now we have to modify the where clause to include that column (we have to make the new column = to a session variable in the page)
The table appears 531 times in our code. Is there some util or method that allows us to change it globally, other than going to each occurrance, and adding the new column to the where clause.
Basically session_onend will not fire in my global.asa files! I have just made a very simple test to prove its not my programming and it still doesnt fire. Session_onstart works a treat but onend will not work even if you force the session to expire with abandon. I have tried on 2 of our servers now and it doesnt work on either.
my simple test is this:
Sub Session_OnEnd application("test") = "hello" End Sub
Now surely that should work. i obviously have a page that writes that test variable to the page but its always empty.
So when *does* Session_OnEnd fire in my Global.asa file? Does it fire when they click a link to leave the site? Does it fire when the session times out?
I have an ASP application that is a electronic purchase orders system. My problem is that only 3 people can authorise a purchase order. When a purchase order is selected I update the table to show that the field is locked. If they complete the form then the database is updated and the lock is removed, all though at this stage the record moves into another part of the system and the lock becomes redundant. If however they dont complete the form the record is left in a permanent locked state, it could be that they decided to look at the record then navigated away or closed the browser. So i thought maybe i could stick some code that updates the database into the session_OnEnd in the global.asa, so after 20 minutes when the session has ended the lock will free. I don't however have any experience with this and don't even know if this will work. The code won't be a problem its just whether this process will actually work. I am thinking that I code put the order_id into a session variable then when the session variable ends i run a sub in the .asa file that gets the session variable and updates the table.
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.
i'm trying to update my db when the user sessions expires..... So i put the codes below on the golbal.asa file... i tried it a few times but this code wont work... but when i tried in Sub session_on_start it is okay... i notice that we could not use server.mappath or any other objects/variable other than Session or Application variable on global.asa .... have any of u guyz trtied the same thing and works
<script language="vbscript" runat="server"> Sub Session_OnEnd
set adoConn = Server.CreateObject("ADODB.Connection") adoConn.Open "Driver=MySQL ODBC 3.51 Driver; Database=dhl_21Feb; Uid=user;Pwd=user;" set rssession = adoConn.execute("Update session set LogoutTime = '10.20',status = 'Log_'")
I would like to start using the global.asa file on an ASP app to store information like connection strings, contact e-mail addresses, etc. However, the person I report to is nervous about this, mostly because he's never been exposed to it. He is of the opinion (because he "thinks he heard somewhere") that application variables - and the ASA file in general - is bad. He's giving me a bit of push-back until I can satisfy him that introducing this won't cause problems for the site. Anything I could find on the MSDN just says how to use it, how it works, etc...which is stuff I already know. Has anyone had any problems with the ASA file? Does it cause any performance lagging? Is there any chance that the Application_OnStart event won't fire?
I have a site wich is in a subdirectory of the webSite. I have to use a global.asa file to set session.timeOut even i create an IIS application on the subDirectory global.asa don't run ?!?
if i create a virtual directory instead of IIS application, the global.asa run fine. How can i do to run global.asa on a subDirectory ?