Click to See Complete Forum and Search --> : why does my asp code not work ?


waheedrafiq
December 9th, 2003, 10:37 AM
I am trying to write something in my webpage ie write to a text file


here is my code
<html?
<title>Write</title>


<body>

<b>this code writes something</b>

<%
dim fs, f
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.CreateTextFile("c:\test.txt",true) ***** this does not happen it does not create a file test.txt why?
f.WriteLine("Hello World!")
f.Close
set f=nothing
set fs=nothing
%>

</body>

</html>


can some help me urgent this is a project that i have to do .

Satishpp
December 9th, 2003, 12:01 PM
Are you getting an error message?

What line is generating the error?

Does the anonymous user have write access permissions to create a file on C: ?

Try searching this forum for filesystemobject. You may get something there.

Satish

waheedrafiq
December 10th, 2003, 03:53 AM
The answer as follows


I am testing this code on my workstation login as administrator all i want to do is write to this file. and no i don't get a error message mate


can you still help me here does the above code work on your workstation

Satishpp
December 10th, 2003, 11:32 AM
Yes, your code works on my machine.

The fact that you are logged into your machine as administrator does not matter. A users permissions for a website are determined by the directory security options selected in the IIS manager, for that site.

Chances are that you have anonymous access setup for your site (which is the default). Now, when you access a web page from your browser, the asp script is running with the security permissions of the internet anonymous user. Ususally the name of this user is IUSR_<machinename> .... where <machinename> is the name of the machine on which you have IIS running.

You need to use Windows explorer and check if this user has write permissions to the C:

Satish