Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
| Search | Today's Posts | Mark Forums Read
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old August 22nd, 2006, 11:16 PM
Authorized User
 
Join Date: Jan 2005
Location: , , .
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default Reading Files on Client's Computer in asp.net

1. My asp.net web pages comes from Server to local Client Machine.

2. It has following jscript code for reading local file. But, this code does not get executed. However, the same code incorporated in ordinary HTML page gets correctly executed.

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="frmReadFile.aspx.vb" Inherits="dkntmp.frmReadFile" smartNavigation="False" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<script language = "jscript" >
   function WriteAFile()
     {var fso,info,rfile,mycontents;
      fso = CreateObject("Scripting.FileSystemObject");
      info = fso.CreateTextFile("c:\\ActiveXasptest.txt");
      info.WriteLine "testing89000067789"
      info.Close
      rfile = fso.OpenTextFile("c:\\ActiveXasptest.txt", 1, false);
      mycontents = rfile.ReadAll;
      rfile.close;
      Response.Write("The contents - " & mycontents);
      return 0;}
</script>
</HEAD>
<body bottomMargin="0" leftMargin="0" topMargin="0" rightMargin="0"
      MS_POSITIONING="GridLayout">
   <form id="frmReadFile" method="post" runat="server">
     <asp:button id="btnReadFile" style="Z-INDEX: 360; LEFT: 640px;
          POSITION: absolute; TOP: 105px; Design_Time_Lock: True"
        runat="server" Font-Size="XX-Small" Font-Names="Arial
          Narrow" ForeColor="White" BackColor="Transparent"
          Width="30px" Height="18px" Design_Time_Lock="True"
      BorderColor="DarkSlateGray" BorderWidth="2px"
        Text="Read" CausesValidation="False"
          BorderStyle="Solid">
     </asp:button>
    </form>
</body>
</HTML>

3. In my vb codebehind i have done
   Me.btnReadFile.Attributes.Add("onclick", "return WriteAFile()")

4. if I place some other code in this function it works, but somehow
   scripting related things do not work.

5. I have Windows scripting engine 5.6 just downloaded and installed.

6. There are NO Security issues of rights etc. as the same thing in
   html page works.

Please guide me as to how to execute functions like above in asp.net.

with Warm Reagrds,

Dilip Nagle







Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get client's computer name? ashu_from_india Oracle 2 May 12th, 2006 10:27 PM
Access to folder on client's computer arshad mahmood Javascript How-To 2 April 12th, 2006 04:30 AM
Client's Files access in asp arshad mahmood Classic ASP Professional 1 April 12th, 2006 02:06 AM
ASP.Net application times out, locks up computer davidayres VS.NET 2002/2003 0 March 18th, 2005 11:30 AM
Reading .eml files in .net ahanson Pro VB.NET 2002/2003 0 May 10th, 2004 01:24 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.