Home All Groups Group Topic Archive Search About
Author
9 Dec 2005 6:02 PM
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

Author
9 Dec 2005 6:09 PM
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.

<jennifer1***@hotmail.com> wrote in message
Show quote
news:1134151373.636284.18620@g44g2000cwa.googlegroups.com...
> 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
>
Author
9 Dec 2005 8:31 PM
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.  :)
Author
9 Dec 2005 6:48 PM
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.

<jennifer1***@hotmail.com> wrote in message
Show quote
news:1134151373.636284.18620@g44g2000cwa.googlegroups.com...
> 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
>
Author
9 Dec 2005 8:32 PM
jennifer1970
Thank you!

AddThis Social Bookmark Button