Reputation: 859
im trying to write a program which create a new text file with asp. it is giving Microsoft VBScript runtime error '800a0035'. However when I change the file for the line
Set f=fs.GetFile("c:\vie4.txt")
to an existing file it does not give this error.
Hello !
Welcome to my Web site!
Microsoft VBScript runtime error '800a0035'
File not found
/simple2.asp, line 33
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" method ="post" action = "simple2.asp" runat="server" >
<div>
<input id="Text1" type="text" value = "fname" />
<input id="Text2" type="text" value ="lname" />
</div>
</form>
<%
response.write(request.querystring("fname"))
response.write(" " & request.querystring("lname"))
fname = request.querystring("fname")
lname = request.querystring("lname")
response.write("<p>Hello " & fname & " " & lname & "!</p>")
response.write("<p>Welcome to my Web site!</p>")
Dim fs,f
Set fs=Server.CreateObject("Scripting.FileSystemObject")
Set f=fs.GetFile("c:\vie4.txt")
Response.Write("File created: " & f.DateCreated)
set f=nothing
set fs=nothing
%>
</body>
</html>
Upvotes: 1
Views: 1732
Reputation: 16
Table1.Rows.Clear();
List<Knjiga> knjige = new List<Knjiga>();
XmlDocument doc = new XmlDocument();
doc.Load(Server.MapPath("biblioteka.xml"));
foreach (XmlElement el in doc.GetElementsByTagName("knjiga"))
{
knjige.Add(new Knjiga()
{
ISBN = el.GetAttribute("ISBN"),
Naslov = el.GetAttribute("naslov"),
Stanje = Int32.Parse(el.GetAttribute("stanje")),
Citano = Int32.Parse(el.GetAttribute("citano"))
});
}
knjige = knjige.OrderByDescending(d => d.Citano).ToList();
foreach (var knjiga in knjige)
{
TableRow tr = new TableRow();
// Cells
TableCell isbn = new TableCell();
TableCell naslov = new TableCell();
TableCell stanje = new TableCell();
TableCell citano = new TableCell();
isbn.Text = knjiga.ISBN;
naslov.Text = knjiga.Naslov;
stanje.Text = knjiga.Stanje.ToString();
citano.Text = knjiga.Citano.ToString();
tr.Cells.AddRange(new TableCell[]{ isbn, naslov, stanje, citano});
Table1.Rows.Add(tr);
}
Upvotes: 0
Reputation: 200293
When in doubt, read the documentation. GetFile
doesn't create files. Use CreateTextFile
for that:
...
filename = "c:\vie4.txt"
If Not fs.FileExists(filename) Then fs.CreateTextFile filename
Set f = fs.GetFile(filename)
...
Upvotes: 4