All,
Unfortanetly VB dosent have any equivelent to eval() so I'm tring to figure
out how to convert a section of my vb into jScript. I'm at best a novice
with javascript and I can't find any jscript examples of how to use
FileStream and StreamReader.
Basically the problem comes converting this line - Dim footer_file As New
IO.FileStream(temp, IO.FileMode.Open, IO.FileAccess.Read) and everything
that comes after it. I've tried:
var footer_file = new IO.FileStream(temp, IO.FileMode.Open,
IO.FileAccess.Read);
and
var fs : FileStream = new FileStream(temp,IO.FileMode.
IO.FileAccess.Read);
but I'm getting Compilation Error's, so I know its a syntax error but I
don't know how to fix it.
Below is the code I'm tring to convert. Any help would be greatly
apreciated.
CES
<%@ Language="JScript" %>
<%
var path = Server.MapPath("anyfile.asp");
var accountRoot = path.split("root");
var temp = accountRoot[0] + "root\\_includes\\temp.txt";
Dim footer_file As new IO.FileStream(temp, IO.FileMode.Open,
IO.FileAccess.Read)
Dim myReader As new IO.StreamReader(footer_file)
Dim footer_temp, footer_txt As String
footer_temp = myReader.ReadToEnd()
var footer_txt = Eval(footer_temp);
<h3><%=footer_txt%></h3
CES - 03 Oct 2003 01:03 GMT
all,
After 2 days I was able to figure out the problem which was NTFS not alowing
access to "Open,FileAccess.Read", which was throwing the exceptions. Still
can't figure out how to solve the NTFS issue but for anyone interested...
just incase your as lost as I am the working code is ...
<%@ Language="JScript" %>
<%@ Import namespace = System.IO %>
<%
var path = Server.MapPath("anyfile.asp");
var accountPath = path.split("cyranodesade");
//var accountRoot = accountPath[0]+ "root\\_includes\\try2.txt";
var accountRoot = "C:\\try2.txt";
var fs:FileStream = new
FileStream(accountRoot,FileMode.Open,FileAccess.Read);
var sr:StreamReader = new StreamReader(fs);
var footer_temp;
footer_temp = sr.ReadToEnd();
%>
<h3><%=eval(footer_temp)%></h3>
> All,
> Unfortanetly VB dosent have any equivelent to eval() so I'm tring to figure
[quoted text clipped - 32 lines]
>
> <h3><%=footer_txt%></h3