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