Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

ASP problem

Posted on 1997-09-05
6
Medium Priority
?
175 Views
Last Modified: 2013-12-25
Using JavaScript, the CreateTextFile()/OpenTextFile()
does not work right. It always gives me "Permission Denied" when I try
to create a file. But the same thing works fine with VBScript. Can you
tell me what's wrong that I'm doing ?
0
Comment
Question by:vsp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 2

Accepted Solution

by:
theTerabyte earned 200 total points
ID: 1854947
the problem is JavaScript is a very security-concious language.  There are many things it won't let you do since it runs on a client machine.  I believe those commands would open a text file on the client's machine, not the server, and there are unly certain places you can access files from to prevent a breach in security, otherwise people would write scripts to ready the /etc/passwd file on uni machines and get passwords, or modify windows stuff.
I BELIEVE if you create a text file, you have the perms to read it, but i don't know.

The point is, the reason you can't do it in favascript but can in others is JavaScript's security features.

HOPE THIS HELPS, (the)Terabyte
0
 

Author Comment

by:vsp
ID: 1854948
I wish, the answer would have told me how to create the text file in JavaScript. It is a rather incomplete answer.
0
 
LVL 2

Expert Comment

by:theTerabyte
ID: 1854949
sorry, let me look at it and try to give you more info....
0
Understanding Web Applications

Without even knowing it, most of us are using web applications on a daily basis. Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We often confuse these web applications tools for websites.  So, what is the difference?

 
LVL 2

Expert Comment

by:theTerabyte
ID: 1854950
Explain how CreateTextFile() and OpenTextFile() is supposed to work, i.e. arguments and such, and i'll try to figure out why it won't work.  It must be the ONE function not covered in my JS book.  However, I was able to answer you question(kinda) from general JavaScript history and knoledge about the history of the language.  
One of the main reasons many browsers didn't support JS or Java until recently is because they were worried it wasn't secure enough, it is someone's program who you don't know that is running on unsuspecting client's machines.  That's why netscape by default warns you about JS and Java, and it can be disabled.  The first versions were pretty buggy and it was very possible, especially in Java, that one could read file of a client's hard drive or network and relay them to a server(uhh oh).  But, as you know can see, those "problems" have been fixed for the most part(i.e. perm errors).
0
 

Author Comment

by:vsp
ID: 1854951
I appreciate your concern on answering my question, thanks !
The CreateTextFile() is supposed to create a text file with these arguments;
      CreateTextFile ("fname",createFlag,permissions)
where:
      createFlag - create a file if non-exsistant, otherwise overwrite.
      permissions- permissions given to the file

FYI-This works okay in VBScript with any combinations of these arguments.

With OpenTextFile(), the story is stightly different.It does not work in JScript but in VBScript these two forms do not work

      Set tf = fs.OpenTextFile ("e:\textFile.txt",1,TRUE,0)

In these it complains of invalid argument TRUE.

      Set tf = fs.OpenTextFile("e:\txtFile.txt", 0,0,0)
      tf.WriteLine("This is a test")

It says "Permission Denied". In this case we are trying to append to a pre-exsistant file.

I have added lot of extra infomation in this comment, which may help you debug the problem.

Thanks, in advance.
0
 
LVL 2

Expert Comment

by:theTerabyte
ID: 1854952
Alright, i've sone some testing, and i'm sorry to say, I don't know why it dosen't work or how to fix it, but I do know the reason is related to JS' Security features.  To do any more testing i'd need the HTML file you're using it in.  If you can send it to me, i might be able to look at it again.....
0

Featured Post

Looking for a new Web Host?

Lunarpages' assortment of hosting products and solutions ensure a perfect fit for anyone looking to get their vision or products to market. Our award winning customer support and 30-day money back guarantee show the pride we take in being the industry's premier MSP.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question