Writing to a file

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
 
K

Kevin Spencer

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.
 
P

Peter Rilling

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.
 
J

jennifer1970

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. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top