Link to home
Start Free TrialLog in
Avatar of gilalig
gilalig

asked on

Create a log file for a web server from a web service

Hello,

I need to write to a file in order to log values received through a web service in ASP.NET/VB.Net. This file must be on the web server . What code can I write for this in the web service ?

Attached is what I have written but I'm not sure if it is good for a web server or only when working with localhost.
Thanks
strWriteLog = "LogDateTime:" & Date.Now.ToString & " Key:" & sKey & " UpdateDate:" & Rec.UpdateDate 
 My.Computer.FileSystem.WriteAllText("C:\inetpub\wwwroot\site\myDir\Files\traceDates.txt", strWriteLog, True)

Open in new window

Avatar of kevink34
kevink34
Flag of United States of America image

Would it work to write an entry to the event log?
Diagnostics.EventLog.WriteEntry(AppName, "Key:" & sKey & " UpdateDate:" & Rec.UpdateDate)

It will track your times, etc.

Just a thought.
ASKER CERTIFIED SOLUTION
Avatar of Mike_V
Mike_V
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gilalig
gilalig

ASKER

Can the streamwriter be used for a file on the web server - not the localhost?

Thanks!