My Session_OnStart works but Session_OnEnd does not work. Here's the
code...can anyone tell me what's wrong with my code or if anything else
on the server that needs to be changed. The Session_OnStart does create
the folder for me with the SessionID as the folder name but
Session_OnEnd does not delete that folder. Code:
A drop down list is populated with certain values from the database and when the selection is changed the post is posted back to itself and ceratin other processing takes place on the same page, based on the selected value. I have modified the code to make a default list item selection (using option selected etc. ) when the page loads the 1st time. I also want the onChange event to fire the 1st time (by taking this default selected item) on page load, not just when user makes a selection from the list.
For some reason my global.asa file is not firing. I have it located in the root of my website (e.g., wwwrootmywebsiteglobal.asa) and I have the web site configured as an "application" in IIS. When I modified the file I also stopped and restarted the web server.
I'm workinbg in Visual Studio 2003. I'm experimenting with creating a session variable, and from all I can gather. the Session_Start event is not firing.
In Global.asx.vb, in the Session Start event, I have the following:
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) ' Fires when the session is started Session("varTest") = "123" End Sub
First off, when I set a break point at that line, it is never reached when the application starts. Secondly, when I try to post a test alert(), to display Session("varTest"), it comes up blank (no error). Finally, if I set Session("varTest") = "123" in my asp page, then display it, it shows up, all of which leads me to believe that the global.asax file is not seen by the project, even though it was inserted automatically.
Problem with global.asa not firing 100% of the time. This error crops up several times throughout the day but if you wait a while and reload the page (could be 5 mins or an hour) it will suddenly start working again.
The error is: ADODB.Recordset error '800a0bb9' Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another. /footer.asp, line 101
Line 101 in the footer.asp file reads: InnovationRS.Open sql, Application("AnymousConnection")
I believe that bad code would produce a persistent error message. The application would either work, or generate an error 100% of the time, not be intermittent. The error is now appearing 3 or 4 times a day with different users reporting it, but like I said, if you wait a while and refresh the page, it is working again. Code:
In the code behind of my ASP.net web page I have code written that is dynamically creating a button. Here is a sample of how I define it.
//Define Variable Button btnNext;
public void someMethod() { btnNext = new Button(); button += new EventHandler(this.btnNext_Click); //then i add the control to the page, then call its click event btnNext_Click(); }
When I clickthis button on the page, the page postsback and its onclick event is never called (stepping through the code shows that it never gets reached). If I click the button a second time, the method is called and it works fine.
I have designed a form which process database Insert, edit and Delete(datagrid). I input userid,password and privilege in textboxes which has validation controls to verify data keyed in. And press the button to perform insert operation. Upto here is fine.
I want to perform edit or delete operations. I put datagrid for that one. After clicking the Update button for the row, the validation controls are firing again. I need to input some temporary data in the form fields to perform actual update operation. How can i stop firing validation controls at this stage?
i am trying to insert a record into my database when a session times out, but the Session_OnEnd doesn't seem to be called... i read somewhere that it is not called but i didn't pay attention to it, and now it seems to be true.
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.
In my site I have a users system, when a user loges in his ID is placed in his cookies (cookies("uid")) so what I am trying to do is write a code in the Global.asa that will write in my DB whenever a loged user session starts and ends.
my problem is that the Session_OnEnd event does not support the use of cookies and even worse then that it does not support the CreateObject method in the Server Object with wich I connect to my DB.
So this is my code in the Global.asa, If you guys have any idea on how to make this code work, despite the disadvantages the Session_OnEnd Event has...
<script language="vbscript" runat="server"> Sub Application_OnStart Dim dbpath dbpath = Server.Mappath("data") & "db.mdb" application("CnStr_Main") = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbpath End Sub
sub Session_OnStart If request.cookies("uid")<>"" then Dim tmpconn,tmpRS,tmpDSNName,tmpsql Set tmpconn = Server.CreateObject("ADODB.Connection") Set tmprs = Server.CreateObject("ADODB.Recordset") tmpDSNName = application("CnStr_Main") tmpconn.Open tmpdsnname tmpsql = "SELECT * FROM users WHERE id=" & request.cookies("uid") tmprs.open tmpsql,tmpconn,3,3 if not tmprs.EOF then tmprs(12) = 1 tmprs.update end if tmprs.close tmpconn.close end if end sub
sub Session_OnEnd If request.cookies("uid")<>"" then Dim tmpconn,tmpRS,tmpDSNName,tmpsql Set tmpconn = Server.CreateObject("ADODB.Connection") Set tmprs = Server.CreateObject("ADODB.Recordset") tmpDSNName = application("CnStr_Main") tmpconn.Open tmpdsnname tmpsql = "SELECT * FROM users WHERE id=" & request.cookies("uid") tmprs.open tmpsql,tmpconn,3,3 if not tmprs.EOF then tmprs(12) = 0 tmprs.update end if tmprs.close tmpconn.close end if end sub </script>
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.
When a session end i want to delete a folder, however it doesn't seem to work, TempFolderPath is a global variable. or do i have to save the folder path in the db and use it when the the session ends ?
sub Session_OnEnd DeleteTempPath(TempFolderPath) end sub
Does this Scripting.FileSystemObject.DeleteFolder will it delete file that are in the folder or just empty folder.
I am tracking all activity on one of my sites, but if the user does not hit the LOGOUT button, I don't get a Logged out entry. I would like to stick it into the global.asa file so that it will do it when their session ends no matter how they exit.
This code below is what I have in my asa file now, but does not seem to be working.
Sub Session_OnEnd IF Session("USER_ID") <> 0 THEN oDb = Server.CreateObject("adodb.connection") ConnStr = "SQL CONNECTION STRING" oDb.Open(ConnStr) oDb.Execute("INSERT INTO Log (mLogin, IP, EventTime, EventDescr) VALUES("+Session("USER_ID")+", '"+Session("USER_IP")+"', GetDate(),'Log Out')") END IF
I'm simply trying to write a session id to a database using Session_OnStart and then remove that line from the database using Session_OnEnd so that I know when a user has logged in and logged out again. Here's the Session_OnStart code that works fine. There's just a bit field and an int field in a SQL Server database: Code:
Does anyone know why the Session_OnEnd subroutine in global.asa never gets called? I set Session.Timeout = 1, I also have debugging code that writes to a text file.
Session_OnStart writes to this file, however Session_OnEnd does not. I am also trying to access a database in this routine and it never happens, however I can access the database from within Session_OnStart. I have tried this on PWS and on line using IIS with the same results.
i know that Session_OnEnd (global.asa) do not support "response" i need somehow to redirect after the Session_OnEnd *if it will shoot of course i understand that there is some way to do this with application?
Sub Session_OnEnd Dim Conn Set Conn = Server.CreateObject("ADODB.Connection") Conn.ConnectionString = Application("Connection_String") Conn.Open 'here is the error .... End Sub
A Conn object is created the same way in Session_OnStart and is used throughout the application, and Application("Connection_String") still exists here (I tested). So I suppose the error is caused by the fact that we are in Session_OnEnd.
Through the years there's always been trepidation about relying on the Session_OnEnd routine being fired at the conclusion of a user session, hence my instinctive avoidance of using it in anything I've created.
Now comes a time when it'd actually be desirable to use this feature; can anyone tell me if its reliability is any better with IIS6 (under Server 2003) than it was with previous IIS incarnations?
I can successfully delete files using fso.DeleteFile when in an ASP script. But in Session_OnEnd, where I'd *really* like to clean up files, it appears that DeleteFile doesn't work. I've tried every combination I could think of. I've verified the filespecs I'm using by logging to a session log file.
BTW, I found out the hard way that I can't reference Request.ServerVariables("APPL_PHYSICAL_PATH") from within Session_OnEnd. I had to copy that to Session("AppPath") to keep it around for the OnEnd event. Without that, ASP just bails out of OnEnd, ignoring the remainder of the subroutine.
I have downloaded the DiscIDCalc program from CDDB. I've used it a lot because I've written my own application for my CD collections (keeping track of the track information of each CD, track duration etc). I've already got all my CDs into the application, I'm now just going through each of the disc again just to add in the DiscID information. I do it by running the DiscIDCalc program, generating the DiscID, and then then copying and pasting this DiscID into my application and then save it. if anyone has successfully generated the DiscID within an asp page? Now I have to have my browser up and this DiscIDCalc program up. Just want to know if there's a way to incorporate the two together (even if it means I'm not using the DiscIDCalc anymore.). This DiscIDCalc has a documentation for its DiscIDCalcDLL.dll but it's not something that I can CreateObject with, so I'm quite clueless... I don't want to use VB to write APIs for that
I use query string to search for records by using GET method. This method will generate querystring automatically by using the form name. Using search field together with drop down is fine but the problem is when i didn't enter any keyword or left the search field blank it won't display any result.
Unless I put "%" in the search field. How do I make the querystring change to "%" whenever the field is blank so that all records will be displayed.
i am trying top update a field in my sql database but it wont let me??? does anyone know if my syntax is correct?? I have a field called userId in the database and want to replace it with my form request. Code:
Method Not Allowed The requested method POST is not allowed for the URL /Database/processForm.asp.
Apache/1.3.33 Server at antonyx.freestarthost.com Port 80
i just got this error, however, i have managed to post data into my database on this server b4, why is this error comin up now, could there be a prob with my asp file??
When using ActiveX Combo Boxes, can you use the GetString method to populate the control? I currently am using AddItem, however, it is taking a long time to process. I know that GetString works well to improve the performance. Here is my code while using AddItem:
Now this is a weird one. I'm having a problem with a system in development. When I post data from a form in IE 5.01 it works fine, but in IE 5.5 it refuses to post the data to the server and in IE 6 it's scatty -- works sometimes but not others. Anyone seen this before? Edit: By the way -- this is normal VBS/ASP running on IIS 5 on an NT server
I have a form that ignores my form validation code. My code works if I use the post method of <%=Request.ServerVariables("SCRIPT_NAME")%>.
But, If I post the form to another .asp page, which I prefer, the code doesn't work. Do anyone have any suggestions? Here's my code.
I have a form that ignores my form validation code. My code works if I use the post method of <%=Request.ServerVariables("SCRIPT_NAME")%>. But, If I post the form to another .asp page, which I prefer, the code doesn't work. Do anyone have any suggestions? Code: