Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / JScript / October 2003

Tip: Looking for answers? Try searching our database.

Using FileStream and StreamReader

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
CES - 02 Oct 2003 05:13 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.