using webclient to write to a .txt file on server

FartNocker

Regular
Joined
Dec 7, 2003
Messages
97
Location
Western North Carolina
HI. I am trying to use a VB .NET desktop app to write some text to a text file on an ASP server. I can read the files OK. but when I use the method below I get the 505 error. The directory is setup as follows:
Username=anonymous, Read=Allow, Write=Allow

If I need to pass the Username=anonymous, how do I do that?

Question is: What more do I need to do to be able to write to this file?

Actually I want to append to this file like a log file.

Thanks,
Mark

Visual Basic:
[size=2][color=#0000ff]
gPostURL = "[url="http://www.somepahe123/com/LOG/time.txt"]http://www.somepahe123/com/LOG/time.txt[/url]"
 
InfoToPost = "Log 1:21pm"
 
 
Try
[/color][/size][size=2][color=#008000]' Apply ASCII encoding to obtain an array of bytes.
 
[/color][/size][size=2][color=#0000ff]Dim[/color][/size][size=2] postArray [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]Byte[/color][/size][size=2]() = Encoding.ASCII.GetBytes(InfoToPost)
 
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] postStream [/size][size=2][color=#0000ff]As[/color][/size][size=2] Stream = wc.OpenWrite(gPostURL, "POST")
 
postStream.Write(postArray, 0, postArray.Length)
 
[/size][size=2][color=#008000]' Close the stream and release resources.
 
[/color][/size][size=2]postStream.Close()
 
wc.Dispose()
 
[/size][size=2][color=#0000ff]Catch[/color][/size][size=2] ex [/size][size=2][color=#0000ff]As[/color][/size][size=2] Exception
 
MsgBox(Err.Description)
 
[/size][size=2][color=#0000ff]End[/color][/size][size=2][color=#0000ff]Try
 
[/color][/size]

ERROR 505 "Method Not Allowed"
 
Last edited:
Back
Top