Writing to a file

  • Thread starter Thread starter jennifer1970
  • Start date Start date
J

jennifer1970

I've got some code that uses FileSystem object to write to a file. I
am getting an error message that says:

Logon failure: unknown user name or bad password.

This doesn't make a lot of sense to me, because I have full permissions
to the folder I am trying to write to.

Code is:

If fso.FileExists(sHdrFilNm) Then
HdrFil = fso.OpenTextFile(sHdrFilNm, 2)
Else
HdrFil = fso.CreateTextFile(sHdrFilNm, True)
HdrFil.Close()
HdrFil = fso.OpenTextFile(sHdrFilNm, 2)
End If

It is failing on "HdrFil = fso.CreateTextFile(sHdrFilNm, True)"

I would assume that the asp page is using my username since it is
running on my computer. Would this not be the case? If not, then why
not?

Thanks,
Jennife
 
Why are using a COM component in a .Net application when you can use the
System.IO namespace instead?

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but you can't make it stink.
 
Unless you have told it otherwise, it is using the account designated to
IIS, regardless what the machine it is running on.

IIS 5 uses the ASPNET account while IIS 6 uses the Network Service account
by default.

Even if you have turned anonymous off, it may still use these accounts
unless you have specified delegation to happen.
 
Because...it was a VB6 application that I converted to .NET. I was
just trying to make it work without spending too much time on what was
in it. Bad of me, I'm sure. :)
 
Back
Top