asp.net consultancy chorley ASP.NET Server Side Scripting Wigan
Website Development Radcliffe

IT Services And Support

Email : ren@techsolus.co.uk
Mobile Phone : 0788 68 41 411
Answerphone : 01204 469683
bespoke invoice systems Standish Information Technology Advice Worsley
    development systems Ramsbottom
data manipulation Farnworth access databases Whitefield SQL connections Atherton
online accessible software Leyland software compatible Coppull


Get connected and Online Tottington
remote management Makerfield code and design Aspull

ASP.Net Writing to a Text File - 28/04/2011

Quite a simple one this, but I'm placing it here as a reminder to myself...

You need this at the top of your file...

<%@ Import Namespace = "System.IO" %>

So to create a file you'll need the "io" namespace - input output - thats anything to do with files as far as I can see. 

dim myfile as streamwriter
myfile = file.createtext(server.mappath("myfolder") & "myfile.txt")
myfile.write(mytextstring)
myfile.close

Don't forget to close the file.  If you do forget then you'll not be able to do anything more with the file until the session timeouts occur.

Post A Comment

Name Comment
programming services asp.net specialist
Valid XHTML 1.0 Transitional
Admin
GD