Hi,
I am ridirecting page to vbs file.
File is running properly but it is asking user to open/save the file.
But i want that it should run without any dialouge box.
My code is :
<%@language="vbscript" %>
<% dim a
a=request.form("sometextbox")
if a="" then
%>
<html>
<body>
--------some code -------
</body>
</html>
<%
else
response.redirect("file.vbs")
end if
%>
It is first asking me to open or save the file.
If i click "open" then it asks to run or don't Run
But i want it to run directly without any user input.
Can anyone help me in this issue.
Thanks in advance.
Anu
16 20797
Hi Anu,
The problem you face is that you have to get your web server to process the VB code in the file, before serving the resulting HTML code back to the user (exactly the same as an ASP file), otherwise you will end up with your user viewing all of your lovely VB code in their browser and feeling horribly confused...
You get round this by doing the following: - Go into Internet Information Services.
- Right-click on the website serving the VBS file and click Properties.
- Select the Home Directory tab, and down the bottom, click Configuration.
- Click Add
- In Extension, type "vbs" (without the quotes), and in Executable, type C:\Windows\system32\inetsrv\asp.dll
Your server will now process VBS files in the same manner as ASP files, and should process as normal.
Failing that, just rename your file to a file extension of ".asp"!
Best regards,
medicineworker
Hi Medicineworker,
First of all thanks for reply.
My vbs file is executing without any problem.
Main thing is i dont want "file download-security warning" dialogue which is asking me to open/save the file.
I want to execute the file without user intervention.
I tried the way u told: but in this way it does not execute the file but it is displaying the whole code of vbs file into browser. and that is really horrible.
I am giving u the code for my vbs file:
abc.vbs -this is to call remote desktop of particular IP:
On Error Resume Next
Dim ForReading
Dim Filename,fil,fold
Filename="C:\temp.txt"
ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
set fil=objFSO.GetFile("c:\temp.txt")
If objFSO.FileExists(Filename) Then
Set objTextFile = objFSO.OpenTextFile _
(Filename, ForReading)
IP=objTextFile.ReadLine
objTextFile.close
'Delete the temporary file
fil.delete(true)
'Call RDP
dim wshell
set wshell=CreateObject("WScript.Shell")
wshell.Run "C:\windows\system32\mstsc.exe /v:"& IP
set wshell=nothing
End If
this is executing fine but needs user intervention that i dont want.
Your help is very much appreciated. Thank you.
Anu.
Anu,
Can you change the file extension to .ASP ?
Jared
Hi Jared
Thanks for reply.
I changed the extension to asp. but then it is displaying the contents of the file as it is in the browser.
Thanks,
Anu
Anu,
How are you navigating to the page? It sounds like you are just opening it with explorer.
Jared
Anu,
How are you navigating to the page? It sounds like you are just opening it with explorer.
Jared
Hi Jared,
I am using
response.redirect("file.vbs")
to execute vbs file. this vbs file is to run exe file for remote desktop.
As u told to change the extension to asp. I tried it as follows:
response.redirect("file.asp")
but then it was displaying the contents of the file on the browser.
Please help me in this issue.
Thanks
Anu
Anu,
From where are you redirecting? from another .ASP or .VBS page?
Jared
Anu,
From where are you redirecting? from another .ASP or .VBS page?
Jared
Hi Jared,
I have given the code for my first asp page in my first post.
from that page i m redirecting to vbs page.
vbs file is executing properly but browser asks me to open/save the file first 'n' then if i click "open" then it asks to run/don't run. If i click "run" then vbs file executes.
I dont want these dialouge boxes( open/save and run/don't ).
Thanks,
Anu
Anu,
What you are saying doesn't make sense, and I get the feeling I'm missing something, that's why I keep asking to reiterate basic questions. The code you have posted is the correct code, it is the correct code I use all the time, and I never have that problem. There are only a few reasons that a server would not display the script correctly:
- If the file extension is not something it recognizes, the server will prompt you to download (save or open). But if it recognizes the file extension for the first file and executes the code correctly, it shouldn't have a problem with the second (as long as the two files have the same file extension). You said the first page was an asp page, so the second one should be too.
- If the file is being opened by windows explorer instead of through an internet connection, but using a response.redirect statement should prevent that.
- If scripting is turned off for a particular file type. Somewhere deep in server settings is the option to turn on or off scripting for different types of files. Medicineworker's instructions above tell how to turn on scripting for this file type. His instructions should work perfectly. I should probably mention that scripting can also be turned off for some folders, but as long as both files are in the same folder, I don't see how this could contribute to the problem.
Besides that, I can't see why there would be a problem.
Jared
Hi Jared,
Please find my answers with ur points:
What you are saying doesn't make sense, and I get the feeling I'm missing something, that's why I keep asking to reiterate basic questions. The code you have posted is the correct code, it is the correct code I use all the time, and I never have that problem. There are only a few reasons that a server would not display the script correctly:
- If the file extension is not something it recognizes, the server will prompt you to download (save or open). But if it recognizes the file extension for the first file and executes the code correctly, it shouldn't have a problem with the second (as long as the two files have the same file extension). You said the first page was an asp page, so the second one should be too.
anu- both files have different extensions. first one is asp 'n' second one is vbs
- If the file is being opened by windows explorer instead of through an internet connection, but using a response.redirect statement should prevent that.
anu - file is opened through internet connection
- If scripting is turned off for a particular file type. Somewhere deep in server settings is the option to turn on or off scripting for different types of files. Medicineworker's instructions above tell how to turn on scripting for this file type. His instructions should work perfectly. I should probably mention that scripting can also be turned off for some folders, but as long as both files are in the same folder, I don't see how this could contribute to the problem.
anu - if i m following Medicineworker's instructions , then it just displaying the contents of vbs file in the browser.
Besides that, I can't see why there would be a problem.
Jared
Can u plz help me now?
Thanks a lot
Regards,
Anu
...
both files have different extensions. first one is asp 'n' second one is vbs
...
Can u plz help me now?
Thanks a lot
Regards,
Anu
The file extension of BOTH files should be ".asp". ASP is a vbs file that a web server can execute. Change the file extension to .asp AND change the response.redirect line to reflect that change. Let me know if that helps.
Jared
The file extension of BOTH files should be ".asp". ASP is a vbs file that a web server can execute. Change the file extension to .asp AND change the response.redirect line to reflect that change. Let me know if that helps.
Jared
Hi Jared,
I have already tried this option.
After changing the extension to asp and also change is made in response.redirect line i.e response.redirect("runfile.asp")
it is displaying the contents of file in browser rather than executing the script.
contents of runfile.vbs file are:
On Error Resume Next
Dim ForReading
Dim Filename,fil,fold
Filename="C:\temp.txt"
ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
set fil=objFSO.GetFile("c:\temp.txt")
If objFSO.FileExists(Filename) Then
Set objTextFile = objFSO.OpenTextFile _
(Filename, ForReading)
IP=objTextFile.ReadLine
objTextFile.close
'Delete the temporary file
fil.delete(true)
'Call RDP
dim wshell
set wshell=CreateObject("WScript.Shell")
wshell.Run "C:\windows\system32\mstsc.exe /v:"& IP
set wshell=nothing
End If
Please suggest me any other option. I got stuck here.
I have read in one of the forums that for running vbs file from asp file we have to set some MIME type. But what should be the MIME type for executing vbs file from asp file?
Can u please provide your valuable help ?
Thanks 'n' Regards,
Anu
Clear the cache or check from a different computer. It is possible that your computer has stored the old version and isn't allowing the server to send the new version. I can't think of anything else. Maybe you could post in the IIS forum.
Jared
Clear the cache or check from a different computer. It is possible that your computer has stored the old version and isn't allowing the server to send the new version. I can't think of anything else. Maybe you could post in the IIS forum.
Jared
Hi Jared,
Thanks first of all. I have posted this on IIS now.
My only purpose is to call RDP on click of link.
'n' I have solved my problem temporarily by calling javascript function instead of vbs file as follows:
<script language="javascript">
function setip(ip)
{
var wshell;
wshell=new ActiveXObject("WScript.Shell");
wshell.Run("C:\\windows\\system32\\mstsc.exe /v:"+ip);
}
</script>
<body>
<a href="#" onclick="javascript :setip('192.20.31.1')"> RDP </a>
</body>
is it correct way of doing?
in above code mstsc,exe should be present in client side.
But I have one doubt related to msctc.exe file in case of vbs file.
In the vbs file i am running mstsc.exe file as follows:
wshell.Run "C:\windows\system32\mstsc.exe /v:"& IP
I want to ask that the file mstsc.exe used for RDP is called from client side or from server side?
If it is at client side 'n' in case it is not available at client side then how can i download it from server side?
Please provide me your valuable help.
Thanks again.
Regards,
Anu
Hi Anu,
If you want to run the RDP executable when a user clicks on a link, surely instead of calling WScript to run it, simply use the following link code: - <a href="file://C:/WINDOWS/system32/mstsc.exe%20\/r%20YOURIPHERE">Click to launch Remote Desktop</a>
That way, you avoid the problem of getting a piece of VBS code downloaded and run on the user's machine as you parse the server's IP into the link and when the user clicks on it it gets passed to the local application instance of RDP.
medicineworker
Hi medicineworker,
Thanks for reply.
I have tried this but its not working.
But now i m using javascipt function rather than vbs function and its working fine.
But the problem is the file mstsc.exe should be present on client machine.
Can you please tell me that is this file available in Windows-95/98/2000 machines also?
If yes then my problem is solved. But if no then i have to first download the file on client machine before running the file.
Thanks,
Anu
Sign in to post your reply or Sign up for a free account.
Similar topics
by: kim |
last post by:
GOOD morning,
I try to open xx.vbs in <href="./xx.vbs"></hef> but it pop up the file
download mesage. How can i disabled it?
I try another solution like this :
set ws =...
|
by: mattmerc |
last post by:
Hi all,
We have all seen lot of method for exporting datagrids to Excel. I have
a slightly different need. I think it should be easy to accomplish but
I am not sure how. I would like when a user...
|
by: Torres |
last post by:
Dear all,
I use this "HyperLink1.NavigateUrl = "\\aoui\myeoe\testing.bat" to run
the batch file. The windows will show a messagebox "RUN" "SAVE" OR
"CANCEL". I want to run the batch file...
|
by: billelev |
last post by:
I have written some code that allows the printing of a report to a pdf file. Ideally, I would like to name the file via code and not have the pdf application prompt the user for a file name. I have...
|
by: Iain |
last post by:
Hi All
I have a datagrid - buit dynamically from a database table - which
contains a column with links to many documents. When the user selects
a link I want them to be able to open the document...
|
by: AnuSumesh |
last post by:
Hi,
I am redirecting from asp page to vbs file.The VBS script resides on same folder as of asp pages in my windows/IIS server.
I am using windows2003 and IIS 6.0.
Script is running properly but...
|
by: =?Utf-8?B?QmlsbHkgWmhhbmc=?= |
last post by:
I have a asp.net page, it uses js to print in IE.
It always has the prompting user window appear.
I have tried:
<input onclick="document.all.WebBrowser.ExecWB(6,6)" type="button"...
|
by: mihir0288 |
last post by:
I m writing a code in c# where i m using a web browser control now i want to save the HTML file that i have opened in the web browser control on my hard disk without prompting save file dialog box....
|
by: raulbolanos |
last post by:
I guys, I got 2 days trying to go thought this and I cannot figure out how to solve it, hope you can help me out here.
I have a ASP Web Application, as simple as this;
<%@ Page Language="C#"...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |