Session_OnEnd没有DeleteFile() [英] Session_OnEnd does not DeleteFile()

查看:73
本文介绍了Session_OnEnd没有DeleteFile()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ASP3(IIS6)站点,其中一些脚本需要生成

临时文件才能工作。现在,事实是:我希望在用户的会话结束时删除那些

临时文件(即使我已经获得了无限的托管空间) ,我觉得留下GB的无用的临时文件有点不礼貌;-))。


然而,Session_OnEnd事件似乎有这样做的一些问题:


1.我在MSDN中发现它无法调用Server.MapPath()。不是很大的问题,我对基本路径进行了硬编码,一切都运行良好。

2.然而,FileSystemObject.DeleteFile()方法似乎受到了影响

同样的问题:我在Session.Abandon()上没有输出错误,但文件

仍在那里。


是有没有解决这个问题的方法?

提前谢谢

Andrea Azzini

解决方案

andrea azzini写道:

我有一个ASP3(IIS6)站点,其中一些脚本需要生成
临时文件才能工作。现在,事实是:我希望在用户的会话结束时删除那些
临时文件(即使我有无限的托管空间,我觉得离开有些不礼貌
GB的无用的临时文件;-))。

然而,Session_OnEnd事件似乎在做这个问题时有一些问题:
2.然而,FileSystemObject.DeleteFile()方法似乎受到了影响。同样的问题:我在Session.Abandon()上没有输出错误但是文件仍然存在。

这个问题是否有解决办法?
提前谢谢
Andrea Azzini




您的IWAM_machinename帐户需要更改文件夹的权限。

Bob Barrows


-

Microsoft MVP - ASP / ASP.NET

请回复新闻组。我的From

标题中列出的电子邮件帐户是我的垃圾邮件陷阱,因此我不经常检查它。通过发布到新闻组,您将获得更快的回复。


ehp ...不可能...我的意思是,有一个托管计划,所以我无法访问

服务器的系统设置。但ASP脚本具有对特定文件夹的完全访问权限。

Bob Barrows [MVP]" <再****** @ NOyahoo.SPAMcom> ha scritto nel messaggio

news:%2 **************** @ TK2MSFTNGP15.phx.gbl ...

andrea azzini写道:

我有一个ASP3(IIS6)站点,其中一些脚本需要生成
临时文件才能工作。现在,事实是:我希望在用户的会话结束时删除那些
临时文件(即使我有无限的托管空间,我觉得离开有些不礼貌
GB的无用的临时文件;-))。

然而,Session_OnEnd事件似乎在做这个问题时有一些问题:
2.然而,FileSystemObject.DeleteFile()方法似乎受到了影响。同样的问题:我在Session.Abandon()上没有输出错误但是文件仍然存在。

这个问题是否有解决办法?
提前谢谢
Andrea Azzini



您的IWAM_machinename帐户需要更改文件夹的权限。
Bob Barrows

-
Microsoft MVP - ASP / ASP.NET
请回复新闻组。我的From
标题中列出的电子邮件帐户是我的垃圾邮件陷阱,因此我不经常检查它。通过发布到新闻组,您将得到更快的回复。



会话和应用程序事件在IWAM帐户下运行,而不是IUSR。

没有其他解决方案。 IWAM需要该

文件夹的文件系统权限。


Bob Barrows

andrea azzini写道:

ehp ...不可能......我的意思是,有一个托管计划,所以我无法访问服务器的系统设置。但ASP脚本具有对该特定文件夹的完全访问权限。

Bob Barrows [MVP]" <再****** @ NOyahoo.SPAMcom> ha scritto nel
messaggio新闻:%2 **************** @ TK2MSFTNGP15.phx.gbl ...

andrea azzini写道:< blockquote class =post_quotes>我有一个ASP3(IIS6)站点,其中一些脚本需要生成
临时文件才能工作。现在,事实是:我想在用户的会话结束时删除那些临时文件
(即使我有无限的托管空间,我觉得它有点不礼貌地留下GB的无用临时文件;-))。

然而,Session_OnEnd事件在执行此操作时似乎存在一些问题:
2.然而,FileSystemObject.DeleteFile()方法似乎受到了影响。同样的问题:我在Session.Abandon上没有错误输出()
但文件仍然存在。

这个问题是否有解决办法?
提前致谢
Andrea Azzini



您的IWAM_machinename帐户需要更改
文件夹的权限。 Bob Barrows

-
Microsoft MVP - ASP / ASP.NET
请回复新闻组。我的From
标题中列出的电子邮件帐户是我的垃圾邮件陷阱,因此我不经常检查它。通过发布到新闻组,您将获得更快的回复。




-

Microsoft MVP - ASP / ASP.NET

请回复新闻组。我的From

标题中列出的电子邮件帐户是我的垃圾邮件陷阱,因此我不经常检查它。通过发布到新闻组,您将获得更快的回复。


I''ve got an ASP3 (IIS6) site, in which some scripts need to generate
temporary files in order to work. Now, the fact is: I would like those
temporary files to be deleted when a user''s session ends (even though i''ve
got infinite hosting space, i feel it somewhat impolite to leave GB''s of
useless temp files ;-) ).

The Session_OnEnd event, though, seems to have some problems in doing this:

1. I found in MSDN that it couldn''t call Server.MapPath(). Not a big
problem, I hardcoded the base path and everything should have worked well.
2. The FileSystemObject.DeleteFile() method, though, seems to suffer from
the same problem: i get no error output on Session.Abandon() but the files
are still there.

Is there any workaround for this problem?
Thanks in advance
Andrea Azzini

解决方案

andrea azzini wrote:

I''ve got an ASP3 (IIS6) site, in which some scripts need to generate
temporary files in order to work. Now, the fact is: I would like those
temporary files to be deleted when a user''s session ends (even though
i''ve got infinite hosting space, i feel it somewhat impolite to leave
GB''s of useless temp files ;-) ).

The Session_OnEnd event, though, seems to have some problems in doing
this:

1. I found in MSDN that it couldn''t call Server.MapPath(). Not a big
problem, I hardcoded the base path and everything should have worked
well.
2. The FileSystemObject.DeleteFile() method, though, seems to suffer
from the same problem: i get no error output on Session.Abandon() but
the files are still there.

Is there any workaround for this problem?
Thanks in advance
Andrea Azzini



Your IWAM_machinename account needs Change permissions for the folder.
Bob Barrows

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don''t check it very often. You will get a
quicker response by posting to the newsgroup.


ehp... not possible... i mean, have an hosting plan so i can''t access the
server''s system settings. But ASP scripts have full access permissions to
that specific folder.
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> ha scritto nel messaggio
news:%2****************@TK2MSFTNGP15.phx.gbl...

andrea azzini wrote:

I''ve got an ASP3 (IIS6) site, in which some scripts need to generate
temporary files in order to work. Now, the fact is: I would like those
temporary files to be deleted when a user''s session ends (even though
i''ve got infinite hosting space, i feel it somewhat impolite to leave
GB''s of useless temp files ;-) ).

The Session_OnEnd event, though, seems to have some problems in doing
this:

1. I found in MSDN that it couldn''t call Server.MapPath(). Not a big
problem, I hardcoded the base path and everything should have worked
well.
2. The FileSystemObject.DeleteFile() method, though, seems to suffer
from the same problem: i get no error output on Session.Abandon() but
the files are still there.

Is there any workaround for this problem?
Thanks in advance
Andrea Azzini



Your IWAM_machinename account needs Change permissions for the folder.
Bob Barrows

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don''t check it very often. You will get a
quicker response by posting to the newsgroup.



Session and Application events run under the IWAM account, not the IUSR.
There is no other solution. IWAM needs file-system permissions for that
folder.

Bob Barrows
andrea azzini wrote:

ehp... not possible... i mean, have an hosting plan so i can''t access
the server''s system settings. But ASP scripts have full access
permissions to that specific folder.
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> ha scritto nel
messaggio news:%2****************@TK2MSFTNGP15.phx.gbl...

andrea azzini wrote:

I''ve got an ASP3 (IIS6) site, in which some scripts need to generate
temporary files in order to work. Now, the fact is: I would like
those temporary files to be deleted when a user''s session ends
(even though i''ve got infinite hosting space, i feel it somewhat
impolite to leave GB''s of useless temp files ;-) ).

The Session_OnEnd event, though, seems to have some problems in
doing this:

1. I found in MSDN that it couldn''t call Server.MapPath(). Not a big
problem, I hardcoded the base path and everything should have worked
well.
2. The FileSystemObject.DeleteFile() method, though, seems to suffer
from the same problem: i get no error output on Session.Abandon()
but the files are still there.

Is there any workaround for this problem?
Thanks in advance
Andrea Azzini



Your IWAM_machinename account needs Change permissions for the
folder. Bob Barrows

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don''t check it very often. You will get
a quicker response by posting to the newsgroup.



--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don''t check it very often. You will get a
quicker response by posting to the newsgroup.


这篇关于Session_OnEnd没有DeleteFile()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆