-
ASP geniuses...
Ok, I'm using 7host.com, and I keep getting errors on this ASP code:
Code:
<html>
<head>
<title>Welcome</title>
</head>
<body>
hi, currently stored values are:
<%
Const ForReading = 1, ForWriting = 2, ForAppending = 8
set fso = server.CreateObject("Scripting.FileSystemObject")
set File = fso.GetFile("D:/user/kenasp/root/storage.txt")
set ts = File.OpenAsTextStream(ForReading, -2)
Do While not ts.AtEndOfStream
myText = myText & ts.ReadLine & vbCrLf
Loop
Response.Write(myText)
%>
<form action = "index.asp">
<input type = "text" name = "text">
<input type = "submit" name = "input" value = "Ok">
</form>
<%
Set FileName = "D:/user/kenasp/root/storage.txt"
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set ConfigFile = Server.MapPath(FileName)
Set TheFile = fso.OpenTextFile(ConfigFile, 2)
TheFile.write Request.QueryString("text") & vbCrLf
TheFile.Close
%>
</body>
</html>
I even setup a default storage.txt file. can anyone help out? I'm totally at a loss for what's wrong.
-
-
ASP isn't like C. you don't get compiler errors...you don't run it through a compiler. But with 7host.com it won't load the page if it has errors...and my page won't load.
-
hi ken
i hope you dont mind but i set this script up at home to run as i have my own web server.. i set up the same directory structure to your storage.txt but used c: instead of d: and this is the error i got:
Microsoft VBScript runtime (0x800A01A8)
Object required: '[string: "c:/user/kenasp/root/"]'
/test/test.asp, line 28
line 28 is looking at the line:
Set FileName = "c:/user/kenasp/root/storage.txt"
i have only started teaching myself asp so not too much idea of a fix but if you try the following site they may be able to help as they are dedicated to ASP and there is some pretty good stuff on there, and also a forum (i did see a number of people having problems with mappath):
http://www.asp101.com/
-
thanks, that helps a little. I'll try that site, too.
-
-
why are you using d:/ ?
Is there a d:/ directory?
Do you know the directory structure of the server?
Maybe that's the problem.
Just my first guess.
I'd say it's better to use relative paths if you can.
I did an ASP project last spring so I'm a bit familiar.
-
hold up...does ASP support come with the free web site account at 7host.com, or do you have to get one of the ones where you have to pay?