starting an exe program using response.redirect in ASP

Is it possible to use response.redirect to start an exe job in ASP?

I thought I had this working at one time.

My code is trying to do a response.redirect "\\server\folder\myjob.exe" but instead what happens is the browser adds "http://webserver" in front of the "\\server\folder\myjob.exe".

Any one have any ideas why this happens? I am fairly certain that this might have worked before and I haven't monkeyed around with this code in a while.

LVL 13
Who is Participating?

Improve company productivity with a Business Account.Sign Up

MorcalavinConnect With a Mentor Commented:
Are you wanting to start an .exe job on the clients pc, or on the server?
I would highly doubt this would work, or else we would have tons of websites opening our mailprograms and other crap without our consent.

samic400Author Commented:
on the client machine.
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

This is only possible via IE using an active-x object and javascript.

Take a look at the question below to find a solution:
kevp75Connect With a Mentor Commented:

even if you can get this to work via an active-x object, ask youself this question.  I go to site A, site A prompts that it wants me to use this active-x object that is going to run format.exe on my machine.
Would you really want to run that program if you were prompted like that?

Now, the question to you is, could myjob.exe be something that may be accomplished via script?
samic400Author Commented:
This code was already in place and working when I took over as a web developer here. The problem is that we upgraded all of our servers from Windows 2000 and Windows NT to Windows 2003.

The piece of code - response.redirect "\\server\folder\job.exe" was working fine in ASP or so I was told.

I guess I could remove the code because the application really isn't necessary now to run and yes, a script, would work and so the same thing.

I guess for my own sanity I wanted to understand how it worked because I had never seen anything like that in ASP before.
my initial guess would be that it is part of an extranet/server farm of some sort.   I've never been able to get a UNC path to work before, however I have heard (or rather seen) that if you can clone the IUSR machine on the web server to server B something like this should work....

I wonder if a server.transfer or server.execute may be better to use.....but than again, personally I think that any script that calls an executable file is just a security breach waiting to happen, as the permissions needed for the executable to be executed are ISUR_ needs to have full control of the file, and possibly even the folder that contains it.

I've seen an instance where a client wanted to use ImageMagick component to resize their images (they didn't want to shell out for a proper component)
What ended up happenning was the server got compromised, becase basically what we were supposed to do to make it work was shell out, and run the resizer via cmd.exe...
geteConnect With a Mentor Commented:
> on the client machine.

I'm not sure if this is what you want:

<a href="C:\WINDOWS\notepad.exe">Open Notepad</a>

Note: IE will give a Run or Save dialog, then a security warning.
ThinkPaperConnect With a Mentor IT ConsultantCommented:
>>My code is trying to do a response.redirect "\\server\folder\myjob.exe" but instead what happens is the browser adds "http://webserver" in front of the "\\server\folder\myjob.exe".
>>Any one have any ideas why this happens? I am fairly certain that this might have worked before and I haven't monkeyed around with this code in a while.

response.redirect is just that - a redirect of a URL
so if your domain was and if you did something like:
it would go to
that's why it's attaching it in the front.

I'd question if it really worked before...

I agree with Morcalavin and Kev - you really don't want to use exe in this case.. Huge security issue..

Gete - that's not exactly what he's looking for. Notepad is (typically) already installed and available on your local machine. So when you run that you run your own version of Notepad on your machine. He is trying to have the user access an application the user doesn't have installed - it is available on the server itself.
@ThinkPaper, I mostly agree to what everyone has posted here. But again:

> instead what happens is the browser adds "http://webserver" in front of the "\\server\folder\myjob.exe".

> on the client machine.

> This code was already in place and working

lead me to guess (wildly) that the users might have been all the while running "\\server\folder\myjob.exe" from their own machines e.g. from Start->Run or other scripts/programs. Thus the simple HTML link:

<a href="\\server\folder\myjob.exe">Run myjob</a>

may have the slightest possibility of being what was sought after :)
ThinkPaperIT ConsultantCommented:
gete: ah. another possiblity i haven't thought of. =)
samic400Author Commented:
The application did work before. It automatically redirected to an application that did reside on the user machine.

Little bit of history.

We are in upstate NY. Hit with major flooding in June 2006, wiped out entire data center. Our servers were older Windows NT/2000 servers and everything was destroyed. Rebuilt data center, installed Windows 2003 servers, restored all data and then this web applicaton, that was a link on a page that fired off this .exe didn't work anymore. I recently started as the web developer and had never worked with that particular web page or .exe until I got compliants that it wasn't working. I wish I could provide more background or information but that is all I was unfortunately left with.

The code in the ASP script was:

<a href='\\server\folder\myjob.exe'>View Report</a>

and this fired off the application on the client PC and everything worked fine.

I have taken off the link to the intranet site because it wasn't working and have told our users to use the exe from their desktop instead. I guess I was just looking for feedback on why it might not have worked and indications above point me to steer away from something like this for security reasons anyway.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.