Wrox Programmer Forums
|
Classic ASP Components Discussions specific to components in ASP 3.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Components 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
 
Old December 15th, 2004, 03:25 AM
Registered User
 
Join Date: Dec 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Opening exe from asp

while opening the vb exe from ASP it opens one pop up window. some files can harm your computer.if the file information below looks suspicious,or you do not fully trust the source, do not open or save the file. This type of file could harm your computer if it contains malicious code. would you like to open the file or save it to your computer? Open save cancel more info. Please help any one
 
Old January 3rd, 2005, 03:41 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 479
Thanks: 0
Thanked 3 Times in 3 Posts
Send a message via MSN to surendran Send a message via Yahoo to surendran
Default

hi,
try this code....
<%Option Explicit%>
<%
mode1=Request.QueryString("imgid")
Response.Buffer = True
On Error Resume Next

Dim strPath

strPath = "filename.exe"
Dim strAbsFile
Dim objFSO
Dim objFile
Dim objStream

strAbsFile = Server.MapPath(strPath)

Set objFSO = Server.CreateObject("Scripting.FileSystemObject")





        If objFSO.FileExists(strAbsFile) Then
        Set objFile = objFSO.GetFile(strAbsFile)
            Response.Clear
            Response.AddHeader "Content-Disposition", "attachment; filename=" & objFile.Name
            Response.AddHeader "Content-Length", objFile.Size
            Response.ContentType = "application/octet-stream"
            Set objStream = Server.CreateObject("ADODB.Stream")
            objStream.Open
            objStream.Type =1
            Response.CharSet = "UTF-8"
            objStream.LoadFromFile(strAbsFile)
            Response.BinaryWrite(objStream.Read)
            objStream.Close
            Set objStream = Nothing
            Set objFile = Nothing
        Else
            Response.Clear
            Response.Write("No such file exists.")
        End If
        Set objFSO = Nothing
%>


surendran
(Anything is Possible)
 
Old January 5th, 2005, 12:09 AM
Registered User
 
Join Date: Dec 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi there
  I tried that code, but the problem is that, the file opened in unreadable code, it cannot be opened and played on the secreen. Also I think we need to define "mode1" in our code. if there was any better ideas I am looking for it.

 
Old January 8th, 2005, 04:57 AM
Registered User
 
Join Date: Dec 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i had tried this coding is working perfectly. For this you have to install the folling exe. "scripten_w2kxp" Try this in google. and then run the following code

<HTML>
<HEAD>
<TITLE> Pop Exe </TITLE>
<link rel="stylesheet" type="text/css" href="../tdtxt.css" >
<SCRIPT language="VBScript" type="text/vbscript">

Function PopExe
     Dim oWSH
     Set oWSH= CreateObject("WScript.Shell")
     oWSH.Run "C:\INETPUB\WWWROOT\SBC\QUIZ\QUIZ.exe", 1,True
     set oWSH = nothing
End Function
</SCRIPT>
</HEAD>

<BODY BODY background = "images/homebg.jpg" onload="PopExe" scroll = no>
<form>
<br><br><br>
<table width=100% align = center>
<tr>
<TD class=btn width=20% STYLE = 'text-align:center;cursor:hand;FONT-SIZE:100%;'onclick = popExe style='filter:glow(color=blue,strength=25);' onmouseover=this.style.filter='glow(color=red,stre ngth=25)' onmouseout=this.style.filter='glow(color=blue,stre ngth=25)'>
<span style='FILTER: Shadow(Color=white, Direction=45);width:200px;font-size:16pt;cursor:hand;color:white;font-weight:bold;'>
Thank You for Using Gyan Kasuti</span></td>
</tr>
</table>


</form>
</BODY>
</HTML>


Kalyanaraman Narayanan
 
Old January 8th, 2005, 05:04 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Quote:
quote:Try this in google. and then run the following code
Please be aware that this code runs at the client through the client side <script> tags.

Obviousuly, if you run this on your server, it *does* run on the server, but in that case, the server acts as a client....

All other computers in the world will run this locally, and it's unlikely they have a file called C:\INETPUB\WWWROOT\SBC\QUIZ\QUIZ.exe

It's even more unlikely they want to run an (untrusted) VB Script that accesses the WScript object.

So, depending on your needs, this probably won't cut it....

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.





Similar Threads
Thread Thread Starter Forum Replies Last Post
run .exe in asp hostxxi Classic ASP Basics 0 June 18th, 2008 04:01 AM
Kill all winword.exe process before opening Word mckly Pro VB Databases 1 March 6th, 2008 01:34 AM
convert ASP to EXE Dimitris Classic ASP Databases 5 July 22nd, 2007 05:46 AM
Regarding To run EXE from ASP vppatil_20 Classic ASP Components 1 September 9th, 2004 03:08 PM
running exe on asp Sarah Classic ASP Components 1 October 7th, 2003 10:53 PM





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