DeleteFile Doesn't Work In Session_OnEnd???

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.

View Replies


ADVERTISEMENT

CDONTS Doesnt Work Always

I am using CDONTS to send mail to the user from my ASP application.
However, the code doenst works all the time. I am able to get mails but
nothing happnes most of the time. The code works maybe once in 20 tries.
What could be the reason?

View Replies View Related

CDONTS Doesnt Seem To Work

i posted earlier, and the response seemed to be there is
another dll i need to use the cdonts object, i used it
fine for awhile on my old setup, i upgraded to 2k3 and it
errors up as if cdonts isnt an object. So is there a dll
i need to have to use the cdonts object in iis 6 or do i
need to rewrite my code to use cdo? (if so, please provide
asp 3 example on how to send an email with recepient,
sender, body and subject)

View Replies View Related

Why FileSystem Doesnt Work Wit My IIS 5.01 On XP

I have got a problem wit da FILESYSTEM in ASP coding. Before I use window 98 installing PWS. Everything works fine....

And now, I use Window XP professional ( Laplop ), everything is updated ( Service Pack, .NET component, ASP.net stuff...

All my ASP code with FileSystem which used to be properly ran cant be executed on my XP server.

There is no message error on da page, but the browser icon keeps spinning and da content is blank, it means u dont see anything happens. I wanna ensure dat all da code is right, cos it work properly with PSW and other servers. I even tested with a simple code, but It still doesnt work..... Code:

View Replies View Related

Ntext Doesnt Work With ASP

I'm using SQL Server and I decided to convert one of the fields from nvarchar to ntext. The transition in the manager was all right, but my ASP pages wouldn't display the ntext and there is no error message. I use Code:

<%=rs("Text")%>

to display the ntext...and there is nothing.

View Replies View Related

GetRow Doesnt Work

I have a database table with several records. Now I am filtering some data based on the "where" statement. If I run the query in analyzer then I get 20 rows. If I run the same query in asp and assign GetRows() to an array, then the array returns only 4. I am not sure if I am using the GetRows wrong. Here is a snipp of my code:

View Replies View Related

DeleteFile

I want to delete a photo when a user update his profile with a ne photo. It takes from the database the file name of the old photo, put in a session("oldPhoto") and update the database with the new one. Then to delete the old foto I've written the following code that is not working:

<%
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
path = "memberphotos/" & session("oldPhoto")
objFSO.DeleteFile(path)

response.redirect("myprofile.asp")
%>

Is there anyone could help me with this problem?

View Replies View Related

Regular Expressions In Fso.DeleteFile

Can I use regexps in fso.DeleteFile? I've found I can use a '?' and probably a '*' (although that seems a tad brutal) but I'm having trouble with expressions like ([a-z]|[0-9]-).

Am I wasting my time trying to get it to work (i.e. does it support them?) If so, how do I use them? Does it have its own quirky syntax or "standard" regexp? Every example I've found so far just mentions deleting something simple like *.txt.

For the record, I need to "tidy up" a directory full of images by deleting files whose names _don't_ contain particular text. It's quite convoluted and would be far easier if I could just go through each file one by one but hey. Here are the details:

1) I have a list of IDs in an array that I've read from a data source. This is the "current ID" list

2) I have a list of image filenames from a directory in another array. The image filenames contain an ID in them. There could be none, one or more images containing the same ID.

3) I look at each file in turn, extract the ID portion and add it to an array of "found" IDs - crucially, this array is only updated if the ID has not been seen before in another filename

4) I then step through this array and use Filter() to see if the ID is in the "current ID" list somewhere

5) If it is missing from the list, that ID is deemed "out of date" and all associated images containing that ID need to be deleted. Message to screen saying that ID has been deleted.

6) If it is in the list, just print a message saying it is "current" and move on.

I realise I could just step through each file and test it against the current ID list but then the output on-screen would be file-by-file and not ID-by-ID. The client doesn't care how many files there are; they don't even care about the underlying structure - they just point the browser to my script and it deletes the files, shows them which IDs have been removed and tells them how many IDs in total have been deleted.

If I went down that route I would have to keep a record of which IDs I've deleted and output the lot at the end instead of 1 by 1 as I go, which leaves the browser hanging for a while and doesn't give the client reassuring feedback as it ploughs through the directory adding the results to the screen row by row. Code:

View Replies View Related

FileSystemObject DeleteFile Method Question

I'm entirely new to using FSO's in ASP and I'm hoping someone can help me with a code sample or something to understand how to implement the DeleteFile method. I'm just trying to write a quick script that deletes the file "<%=Path%>"; where "Path" includes the full path and filename to delete.

View Replies View Related

Doesnt Retun All Columns

I have a query in ASP that does a select * from table
It doesnt retun all columns!
When i use objRS("columnname") I get blank. This only effects some colums and I fix it by using

select *,missingcolumn1,missingcolumn2 from table

View Replies View Related

SQL Db Doesnt Support The Cookie

I wrote the code for Members of Register. and i use cookie in this code, My database is SQL server. SQL server dosent support the cookies in my codes i dont know why this cause but my codes are working without any cause .

View Replies View Related

Assignment Doesnt Assign

My ASP page contains the following VBScript code:

<%
zipCode = Request.Form("zip")
%> <br>zip: <%= zipCode %>, rf: <%= Request.Form("zip") %>

When I enter "abc" into the "zip" field on the form, I get the
following output:

zip: , rf: abc

Why doesn't the first statement assign the "abc" string to the
variable "zipCode"? What am I not seeing?

View Replies View Related

PWS On NT Doesnt Display Asp/ And Installation

My friedn is using PWS on NT4 machine, its a local machine, whenever he directs to an .asp page, visual interdev starts.

How can we over ocme this.I had solved this problem long time ago. Now i dont remember. Also to install IIS4.0 do we need to install MTS? if yes, where can we get
it?

View Replies View Related

Is The Session_OnEnd

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.

View Replies View Related

Sub Session_OnEnd

i have the following code in the "Sub Session_OnEnd" routine that does not
seem to run..... Code:

View Replies View Related

Session_OnEnd

Is the session ID still available in the Session_OnEnd function in my global.asa?

View Replies View Related

CDONTS Object Doesnt Recognize Simplified Chinese Characters

When we send a mail using the code below,we do not get simplified chinese characters if they are present in the body but we get junk in the mail and we need to change the mails encoding to simplified chinese to see the Chinese characters.

'CDONTS object
set objMail = Server.CreateObject("CDONTS.NewMail")
objMail.MailFormat = 0
objMail.SetLocaleIDs(65001)
objMail.From = sFromEmail
objMail.To = sToEmail
objMail.Subject = sSubject
objMail.Body = sMessage
objMail.Send
set objMail = Nothing

View Replies View Related

Doesnt Display Char Type Data Field Length 1

I have one field char type data length 1.. It has data either 1 or 2 in all the field tht I have checked through enterprise manager.

I'm running query:

"select * from table" and fetching all the records and displaying...

It display all the data except data from this field..Doesnt display anything..

I had put Response.write rs("fieldname")

What could be the problem?

View Replies View Related

Global Session_Onend

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.

View Replies View Related

Using Cookies And DB In Session_OnEnd

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>

View Replies View Related

Global.asa And Session_OnEnd

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?

View Replies View Related

Global.asa Session_OnEnd

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.

View Replies View Related

Session_OnEnd On Array

Why this code is not executing the Session_OnEnd on the Array?

Sub Session_OnEnd
dim pArray

pArray=Application("ref")

for b=1 to 100
pArray(b)=""
next

Application.Lock
Application("ref")=pArray
Application.UnLock

View Replies View Related

Global.asa @ Session_OnEnd

I am having problem with Global.asa

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.

View Replies View Related

Global.asa / Session_OnEnd

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

End Sub

Any ideas?

View Replies View Related

Using Session_OnEnd In The Global.asa?

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:

View Replies View Related

Session_OnEnd Not Working

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.

View Replies View Related

Redirect From Session_OnEnd

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?

View Replies View Related

ADO Connection Object In Session_OnEnd

Why doesn't the following code work?

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.

View Replies View Related

Session_OnEnd Method Not Firing

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:

View Replies View Related

Old Clunker Re-visited: Session_OnEnd In Global.ASA

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?

View Replies View Related

Triggering Session_OnEnd When User Close Window

We have a solution where we want to control the number of users logged
in at the same time.

So when the user log in we check number of currentusers agains
allowedusers and increment a currentusers (in the database).

On Session_onEnd or when a user logout (actually I abandon the session
on logout) we decrease currentusers.

But as we all know when the browser is closed or the user just go to
another site this decrease does not appear.

It will of course trigger when Session goes to timeout, but I imagine
a lot of angry users calling support when they are denied access.

View Replies View Related

Asp Does Not Work

i use a IIS 5.1 with win XP with the newest updates etc.
its possible to start aspx and html files but not asp files
what could it be ? what can i check ?

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved